Member Avatar for handsome_94
void hexad(int i)
{
                 int j=0;
                 int x=0;
                 int chii=0;
                 
                 while(x<8)
                 {
                 second2[x]=' ';
                 second1[x]=' ';
                 x++;
                 }
                 
                 
                 
                 switch(codesum)
  {
                 case 744 :                       
                            while(i<12 && temp[i]!='\0')
                            {
                               second2[j]=temp[i];
                               i++;
                               j++;
                            }       
                            
                            strcpy(second1,"CE   ");
                                                                                                                         
                            break;

                 case 410 : while(i<12 && temp[i]!='\0')
                            {
                               second2[j]=temp[i];
                               i++;
                               j++;
                            }     
                            
                            chii=second2[0];
                            
                            switch(chii)
                            {
                                          'A' : strcpy(second1,"8F   ");      // Gives error here 
                                                strcpy(second2,"     ");
                                                break; 
                                                
                                          'B' : strcpy(second1,"88   ");    // Gives error here too!!
                                                strcpy(second2,"     ");
                                                break; 
                                                
                                          'C' : strcpy(second1,"89   "); // Gives error here too!!
                                                strcpy(second2,"     ");
                                                break; 
                                                
                                          'D' : strcpy(second1,"8A   ");  // Gives error here too!!
                                                strcpy(second2,"     ");
                                                break; 
                                                
                                          'E' : strcpy(second1,"8B   ");  // Gives error here too!!
                                                strcpy(second2,"     ");
												break; 
                                                
                                          'H' : strcpy(second1,"8C   ");  // Gives error here too!!
                                                strcpy(second2,"     ");
                                                break; 
                                                
                                          'L' : strcpy(second1,"8D   ");  // Gives error here too!!
                                                strcpy(second2,"     ");
                                                break;  
                            
                                        default: strcpy(second1,"8E   ");                     
                                                 
                            }
                            
                            
                            break;

Guyz and galz

I've this wierd problem whenever i compile ma .c file using devcpp , it gives me the following error at the lines I've marked above:

"D:\Compilers\Untitled10.cpp expected `;' before ':' token"

Plz. help. I cannot understand what's wrong with this code. Tried in visual c++, same error there too!!

Where's your C++ case reserved word?

Member Avatar for handsome_94

Oh!! I just cannot believe it...I posted tht, damn it's so humiliating. slipped out of ma mind. :-((

switch(chii)
                            {
                                          'A' : strcpy(second1,"8F   ");      // Gives error here 
                                                strcpy(second2,"     ");
                                                break; 
                                                
                                          'B' : strcpy(second1,"88   ");    // Gives error here too!!
                                                strcpy(second2,"     ");
                                                break; 
                                                
                                          'C' : strcpy(second1,"89   "); // Gives error here too!!
                                                strcpy(second2,"     ");
                                                break; 
                                                
                                          'D' : strcpy(second1,"8A   ");  // Gives error here too!!
                                                strcpy(second2,"     ");
                                                break; 
                                                
                                          'E' : strcpy(second1,"8B   ");  // Gives error here too!!
                                                strcpy(second2,"     ");
												break; 
                                                
                                          'H' : strcpy(second1,"8C   ");  // Gives error here too!!
                                                strcpy(second2,"     ");
                                                break; 
                                                
                                          'L' : strcpy(second1,"8D   ");  // Gives error here too!!
                                                strcpy(second2,"     ");
                                                break;  
                            
                                        default: strcpy(second1,"8E   ");                     
                                                 
                            }
                            
                            
                            break;

You forgot to put a 'case' keyword in the inner switch. Your code shd be like :

switch(chii)
                            {
                                   case  'A' : strcpy(second1,"8F   ");      // Gives error here 
                                                strcpy(second2,"     ");
                                                break; 
                                                
                                      case 'B' : strcpy(second1,"88   ");    // Gives error here too!!
                                                strcpy(second2,"     ");
                                                break; 
                                                
                                         case 'C' : strcpy(second1,"89   "); // Gives error here too!!
                                                strcpy(second2,"     ");
                                                break; 

                                                .
                                                .
                                                .
                                                .
                                                .
                                                .
                                                .
                                                .
                                                .
Member Avatar for handsome_94

yes..thank you all. I'm embarassed. stupid mistake. :-(

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.