Wednesday, 4 November 2015

Write A Program To Find A Grade Using Switch Case

#include <iostream>
using namespace std;

int main ()
{
//By-Ghanendra Yadav
   char a;
   cout<<"Enter The Grade As (A,B,C,D,E)\n";
   cin>>a;
   switch(a)
   {
   case 'A' :
      cout << "Excellent!" << endl;
      cout << "Your grade is " << a << endl;
      break;
   case 'B' :
     cout << "Near Excellent!" << endl;
     cout << "Your grade is " << a << endl;
     break;
   case 'C' :
      cout << "Well done" << endl;
      cout << "Your grade is " << a << endl;
 break;
   case 'D' :
      cout << "You passed" << endl;
      cout << "Your grade is " << a << endl;
 break;
   case 'E' :
      cout << "You Failed Next Time Be Try To Better" << endl;
      cout << "Your grade is " << a << endl;
 break;
   default :
      cout << "Invalid grade" << endl;
      break;
   }
 

   return 0;
}

Output:-


1 comment:
Write comments

Recommended Posts × +