Closed Thread
Results 1 to 2 of 2

Thread: Getting a compile error in dev

  1. #1
    hbk
    hbk is offline Learning Programmer
    Join Date
    Mar 2010
    Posts
    68
    Rep Power
    0

    Getting a compile error in dev

    The compiler is displaying that i have a syntax error at the end of input for the below code

    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); 
    }
    Its telling me that i have a syntax error at the end of input, which is the above code end.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Join Date
    Jul 2006
    Posts
    16,491
    Blog Entries
    75
    Rep Power
    143

    Re: Getting a compile error in dev

    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.
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Compile error help
    By breimer273 in forum C and C++
    Replies: 1
    Last Post: 04-02-2011, 04:55 AM
  2. Weird Compile Error (C)
    By breimer273 in forum C and C++
    Replies: 3
    Last Post: 03-15-2011, 05:45 AM
  3. compile error plz help
    By mmo-dev in forum C and C++
    Replies: 29
    Last Post: 02-14-2010, 08:42 AM
  4. Don't really understand the compile error, help?
    By MichaelNQ in forum C and C++
    Replies: 2
    Last Post: 09-16-2009, 07:26 PM
  5. PHP Compile Error
    By Hektor in forum Linux Applications
    Replies: 5
    Last Post: 11-18-2008, 06:36 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts