I'm learning about switch statements and came across this in my book:
"The switch statement is different from similar statements in languages such as Pascal in a very
important way. Each C++ case label functions only as a line label, not as a boundary between
choices. That is, after a program jumps to a particular line in a switch, it then sequentially
executes all the statements following that line in the switch unless you explicitly direct it otherwise.
Execution does not automatically stop at the next case. To make execution stop at the
end of a particular group of statements, you must use the break statement. This causes execution
to jump to the statement following the switch."
- excerpt from C++ Primer Plus 5th Ed. by Stephen Prata
Does this mean that if I have this snippet of code:
1 2 3 4 5 6 7 8 9
switch (num)
{
case 1 : cout << "GoodBye"break;
case 2 : cout << "Good Morning"break;
case 3 : cout << "Good Afternoon"break;
default : cout << "Good Evening";
and omit the breaks, that it will go through all the switch cases that come after the triggered one.
I've been to plenty of schools that lock out the command prompt, what they don't do is prevent you from writing batch files and executing your code that way ;)