// завантаження данних з файлів
private void ReadDataFromFile()
{
string str; // допоміжні змінні
string[] tmp;
try
{
// читання бази знань
using (StreamReader sr = new StreamReader("base.xp", System.Text.Encoding.Default))
{
while ((str = sr.ReadLine()) != null)
{
string[] line = str.Split('=');
switch (line[0])
{
case "N": N = Convert.ToByte(line[1]);
question = new string[N];
break;
case "PH": PH = Convert.ToDouble(line[1]);
break;
case "P+":
tmp = line[1].Split(' ');
Pp = new double[tmp.Length];
for (int i = 0; i < tmp.Length; i++)
{
Pp[i] = Convert.ToDouble(tmp[i]);
}
break;
case "P-":
tmp = line[1].Split(' ');
Pm = new double[tmp.Length];
for (int i = 0; i < tmp.Length; i++)
{
Pm[i] = Convert.ToDouble(tmp[i]);
}
break;
case "H": H = line[1];
break;
}
}
}
// читання списку запитань
using (StreamReader sr = new StreamReader("quest.dat", System.Text.Encoding.Default))
{
if ((str = sr.ReadLine()) != null)