bool validateCourse ( int courseNum )
{
         switch ( courseNum )
     {    
         case 4587:
         case 4581:
         case 9696:
         case 4590:           
         case 4580:
         case 4599:
         case 4583:
         case 8997:
              return true;
         case default: 
              return fasle;
     }        
}

I need it so if the user enters anything but these course numbers it will return false. When I compile it says there is something wrong with the default. Can anyone help?

Recommended Answers

All 3 Replies

bool validateCourse ( int courseNum )
{
         switch ( courseNum )
     {    
         case 4587:
         case 4581:
         case 9696:
         case 4590:           
         case 4580:
         case 4599:
         case 4583:
         case 8997:
              return true;
         case default: 
              return fasle;
     }        
}

I need it so if the user enters anything but these course numbers it will return false. When I compile it says there is something wrong with the default. Can anyone help?

Lol! I guess my compiler doesn't recognize "fasle" and "false" as the same thing...

Just add the line:

#define fasle false

to the top of your file and the program will work!

commented: Very bad - but what a laugh :) +20
commented: haha, that was nice :) +1

You do not need to put in the case keyword before the default keyword

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.