The compiler is displaying that i have a syntax error at the end of input for the below code
Its telling me that i have a syntax error at the end of input, which is the above code end.Code:void doctorreport(void) { system("color 2"); char Target[50]; int tell=0; int Found=0,count=0; char doctor1[30],doctor2[30],doctor3[30]; int health=0,fees=0,collected=0; int choice=0; if((customer1=fopen("transaction.txt","r"))==NULL) printf("THE FILE IS EMPTY"); else { printf("\n\n\t\t PLEASE ENTER A OPTION BELOW FOR A DOCTOR REPORT"); printf("\n\n\t\t 1. DR.ROBERT WILLIAMS"); printf("\n\n\t\t 2. DR.JAMES BROWN"); printf("\n\n\t\t 3. DR.JOHN WHYTE"); printf("\n\n\t\t ENTER AN OPTION:"); scanf("%d",&choice); Sleep(1500); system("cls"); system("color 2"); switch(choice) { case 1:{ strcpy(doctor1,"Dr.Robert.Williams"); while( fscanf(customer1,"%s %s %s %s %s %d %d %d %d",det.name,det.regis,det.pname,det.treatment,det.piont,&det.fees,&det.collect,&det.insure,&det.balance)==9) { { if(strcmp(doctor1,det.name)==0) { count++; Found=1; printf("\n\t\t NAME:%s",det.pname); } printf("\n\t\t DOCTORS NAME:%s",doctor1); printf("\n\t\t NUMBER OF PATIENTS:%d",count); } }break; case 2:{ strcpy(doctor1,"Dr.James.Brown"); while( fscanf(customer1,"%s %s %s %s %s %d %d %d %d",det.name,det.regis,det.pname,det.treatment,det.piont,&det.fees,&det.collect,&det.insure,&det.balance)==9) { { if(strcmp(doctor1,det.name)==0) { count++; Found=1; printf("\n\t\t NAME:%s",det.pname); } printf("\n\t\t DOCTORS NAME:%s",doctor1); printf("\n\t\t NUMBER OF PATIENTS:%d",count); } }break; case 3:{ strcpy(doctor1,"Dr.John.Whyte"); while( fscanf(customer1,"%s %s %s %s %s %d %d %d %d",det.name,det.regis,det.pname,det.treatment,det.piont,&det.fees,&det.collect,&det.insure,&det.balance)==9) { { if(strcmp(doctor1,det.name)==0) { count++; Found=1; printf("\n\t\t NAME:%s",det.pname); } printf("\n\t\t DOCTORS NAME:%s",doctor1); printf("\n\t\t NUMBER OF PATIENTS:%d",count); } }break; case 4: printf("\n\n\t\t\t YOU HAVE CHOOSEN TO EXIT THE PROGRAM OPTION");break; default:printf("\n\n\t\t\t YOU HAVE ENTERED AN INCORRECT OPTION"); } } fclose(customer1); }
I tried compiling the above code and got this:
customer1 undeclared
NULL undeclared
det undeclared
Also, your last } is for the switch statement, not for the function.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks