Friday, 2 May 2014

Write a program take the character input from the user and determine grade of child.(using switch) Output should like:

Leave a Comment


Write a program take the character input from the user and determine grade of child.(using switch)
Output should like:

Enter grade of your child: A
Your child is Excellent in class

Enter grade of your child: B
Your child is very Good in class

Enter grade of your child: C
Your child is good in class

Enter grade of your child: D
Your child is Poor in class

Enter grade of your child: F
Your child is Fail in class


#include <iostream>            
using namespace std;
int main()
{
    char c;
cout<<"Enter a Grade:";
cin>>c;
switch(c)
{
case'A':
case'a':
    cout<<"\nYour Child is excellent in class";
    break;
case'B':
case'b':
    cout<<"\nYour Child is very good in class";
    break;
    case'C':
case'c':
    cout<<"\nYour Child is good in class";
    break;
    case'd':
case'D':
    cout<<"\nYour Child is poor in class";
    break;
    case'E':
case'e':
    cout<<"\nYour Child dull in class";
    break;
    case'F':
case'f':
    cout<<"\nYour Child is fail in class";
    break;
default:
    {
        cout<<"\n You Entered invalid Grade";
    }


}
    return 0;
}
 



 





If You Enjoyed This, Take 5 Seconds To Share It

0 Questions: