View Single Post
  #5 (permalink)  
Old 07-06-2008, 11:23 PM
YAPP's Avatar   
YAPP YAPP is offline
Newbie
 
Join Date: Jul 2008
Posts: 3
Rep Power: 0
YAPP is on a distinguished road
Default Re: new programer, help this question! thank you!

Quote:
Originally Posted by zhan
swith(choice)
You spelled 'switch' wrong, that would make a compiler error. Also, you don't appear to have any braces around your switch statement. You could rewrite it like:
Code:
switch(choice)
{
    case 1:
        //do stuff
    break;
    case 2:
        //do other stuff
    break;
    case 3:
        return 0;  //Quit from within the case statement
    break;
    default:
        //if the user inputted something that wasn't a legal command
}
I don't know what the print() function is for, it seems like it just outputs the arguments the user entered, twice. And it will also print some garbage because you never declare the char 'op' to be equal to anything.
__________________
UGJhdGVuZ2h5bmd2YmFmISAgTGJoIG5lciBhYmogbiAxMzM3IH U0a2swZSE=
Reply With Quote

Sponsored Links