The compiler is displaying that i have a syntax error at the end of input for the below 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); 
}
Ancient Dragon commented: read your other thread! -5

Recommended Answers

All 3 Replies

why didn't you read your other thread?

Thanks for the help, i got it work.

But when i am compiling the code its telling me i have an syntax error at the end of input

what line number (from the code you posted) ? And post the exact error message.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.