case'1': is for switching on any integer type, though char is most common for this case 1: is for switching on any integer type, char less common case"1": is illegal syntax case = 1: is illegal syntax
Don't use goto. Instead use a do/while loop( since you will run the program a minimum of one time.) ex:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
bool runProgram = true;
do
{
cin >> pick;
switch( pick )
{
case 1:
std::cout << "Pepsi" << std::endl;
break;
//do the rest of case
default:
std::cout << "Invalid choice." << std::endl;
runProgram = false;
break;
}
} while( runProgram ); //that means do it while runProgram is true it is
//the same as while( runProgram == true )
As you learn write down the notes in your own words and fill a notebook with condensed rules and syntax examples for reference. It will reinforce everything and be a handy reference at the same time.