Originally posted by Jamsan
im not great with the whole printf scanf business so just convert my cout cins
Code:
cout << "Enter employee pay code: ";
cin >> int code;
switch (code)
{
case 1: //insert code for paycode 1
break;
case 2: //insert code for paycode 2
break;
case 3: //insert code for paycode 3
break;
case 4: //insert code for paycode 4
break;
default: //insert code if they input something else besides 1-4
break;
}
Spacing is a little weird... otherwise thats right
Code:
switch(variable)
{
case (number or SINGLE character) // this is like the variable == blank
//code to run if this is true
break;
case (number or SINGLE character)
//code to run if this is true
break;
default: //if none of the case statements above were true, then this is run
//code to run if no other case is true
break;
}
Please use code tags: [ code ] and [ /code ] without the spaces
Also, you cannot run comparisons in a switch, its really just an == kind of thing.