Write program to use switch statement to check single character input
No need to check the lower case value.
#include <iostream> int main()//w w w .j a v a 2s . co m { char grade; std::cout << "Enter your letter grade (ABCDEFG): "; std::cin >> grade; switch (grade) { case 'A': std::cout << "A!\n"; break; case 'B': std::cout << "B!\n"; break; case 'C': std::cout << "C!\n"; break; case 'D': std::cout << "D!\n"; break; case 'E': std::cout << "E!\n"; break; case 'F': std::cout << "F!\n"; break; case 'G': std::cout << "G!\n"; break; default: std::cout << "other!\n"; break; } return 0; }