Switch loops example
//switch statement example
//switch_ex.cpp
#include <iostream>
using namespace std;
int main()
{
char grade; //for user input
cout << "\nWhat grade would you like in this class?";
cout << "\n\tYour choices are A, B, C, D, and F\n";
cin >> grade;
//add some error checking here!
switch(grade)
{
case 'A':
cout << "\n\tExcellent choice. Now go earn it!\n\n";
break; //"breaks" you out of the switch statement
case 'B':
cout << "\n\tGood choice. Why not go for an A?\n";
break;
case 'C':
cout << "\n\tI think you should set your goals higher\n";
break;
case 'D':
cout << "\n\tCome see me after school\n";
break;
case 'F':
cout << "\n\tAbsolutely an unacceptable choice! I'm calling your mom\n";
break;
} //end of switch
cout << "\n\t\tThe program is done!\n\n\n";
return 0;
}//end of main