A "while" loop performs an action while a condition is true, thus:
while( input != 's' )
{
//execute code
}
executes code while character "input" is not the lower case letter 's'.
A "switch" structure looks at a given integral value, and makes choices depending on what the choice is, thus:
switch( input )
{
//process integral value
}
looks at the character "input" and executes code depending on what "input" is equal to. For example:
case 'a':
says "if input is an 'a', do the following", and
subtotal += 1;
break;
says "add 1 to variable 'subtotal' (i.e. add a dollar), and don't execute any of the code that follows.
The switch structure continues to check for given inputs, and if no matching "case" is found, the "default" case is executed, i.e.
cout << "Incorrect character entered" << endl;
So basically, once the program begins execution, this is what the code should do:
get user input
while the input is not 's' for subtotal
see what to do based on input (switch logic)
get user input again
print the subtotal
end program