vincent - 2014-07-21

//switch problem

# include <iostream>

using namespace std;

int main()
{
double y=0.0;
do
{
int g, a, b, c, d, e, f, h, i;

```       cout << "Enter your letter grades:\nPress Z to end input ";
cout << "\nGuide for Inputs\nEnter\n a if the grade is A\n b if the grade is B+\n c if the grade is B\n d if the grade is C+\n e if the grade is C\n f if the grade is D+\n h if the grade is D\n i if the grade is F\n";

while (( g = cin.get()) != EOF)

{
switch (g){
case 'a':
++a;
break;

case 'b':
++b;
break;

case 'c':
++c;
break;

case 'd':
++d;
break;

case 'e':
++e;
break;

case 'f':
++f;
break;

case 'h':
++h;
break;

case  'i':
++i;
break;

case  '\n':
case  '\t':
case   ' ':
break;

default:
cout<< " You entered a wrong code. Please see the guidelines above";
break;

}
}

cout << "\n\nTotal for each letter grade:\n A: " << a << "\n B+: " << b << "\n B: " << c <<"\n C+: " << d<<"\n C: " << e<<"\n D+ " << f <<"\n D: " << h<<"\n F: " << i << "\n";
system("pause");

cout << "\n press 1 if you wish to continue";
cout << " else press 0\n";
cin >> y;
}while ( y==1);

return 0;
```

}