void testing people people test test system cls FILE f1 f1 fopen Peopl

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
void testing(people **h, people **t,test **o, test **q)
{ system("cls");
FILE *f,*f1;
f1=fopen("People.txt","a+");
f=fopen("qwestions.txt","r");
int mark=0;
int n=0;
test *current = NULL;
test *answer = NULL;
//выделяем память
if (!(current = (test *)malloc(sizeof(test))))
return;
do
{
printf("Вопрос номер %d: ", n);
fprintf(f,"%s",&current->qwestion);
if(feof(f))break;
printf( "%s\n",current->qwestion);
if(current->variant =='0')
{
printf("Введите номер правильного ответа");
scanf("%d",answer->t);
if(current->t==answer->t){mark=mark+current->grade;}
else {mark=mark-current->grade;}
}
else
{
printf("Введите слово отвечающее на вопрос");
scanf("%s",answer->vord);
if(current->vord==answer->vord){mark=mark+current->grade;}
else {mark=mark-current->grade;}
}
}
n++;
while(!feof(f));
printf("Ваш IQ равен : %d",mark);
f1=mark;
fprintf(f1,"%d\n",current->iq);
free(current);
}