#include<stdio.h>
#include<stdlib.h>
#define ques 50
void read();
void cal();
int main()
{
char bookA[ques],bookB[ques],bookC[ques];
int right=0,wrong=0;
float grade=0.0;
char num[6],book[2],name[15],sname[15],ans[50];
read();
cal();
void read()
{
FILE*EOLOS=fopen("booklet.txt","r");
if(EOLOS==NULL)
{
printf("file can not find\n");
return 0;
}
fscanf(EOLOS,"%s%s%s",bookA,bookB,bookC);
fclose(EOLOS);
}
void cal()
{
FILE*EOLOS=fopen("answer.txt","r");
if(EOLOS==NULL)
{
printf("file can not find\n")
}
while(!feof(EOLOS)
fscanf(EOLOS,"%d%s%s%s%s",&num,book,name,sname,ans);
if(book[0]=='A')
for(int i=0;i<ques;i++)
{
if(ans==bookA&&bookA!='*')
right++;
else
wrong++;
} else if(book[0]=='B')
for(int i=0;i<ques;i++)
{
if(ans==bookB&&bookB!='*')
right++;
else
wrong++;
}
else
for(int i=0;i<ques;i++)
{
if(ans==bookC&&bookC!='*')
right++;
else
wrong++;
}
grade=float( 2*(right-float(wrong/4)));
printf("%7d%20s%20s%10d%10d%12.2f\n",num,name,sname,right,wrong,grade);
}return 0;
}
hata olarak read' : local function definitions are illegal
call :local function definitions are illegal
hatalarını veriyor bulamadım çözümü yardım ederseniz sevinirim