SHARE
TWEET

Switch Q2

DARKADVERSARY Oct 24th, 2019 92 in 312 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.  
  6.     char grade;
  7.  
  8.     cout << "Enter your grade : ";
  9.     cin >> grade;
  10.  
  11.     switch (grade) {
  12.  
  13.         case 'A':
  14.  
  15.             cout << "Excellent";
  16.             break;
  17.  
  18.         case 'B':
  19.  
  20.             cout << "Average";
  21.             break;
  22.  
  23.         case 'C':
  24.  
  25.             cout << "Poor";
  26.             break;
  27.  
  28.         case 'D':
  29.         case 'E':
  30.         case 'F':
  31.  
  32.                 cout << "Try Again!";
  33.                 break;
  34.  
  35.         default:
  36.  
  37.                 cout << "Sorry, unrecognised grade entered!";
  38.  
  39.  
  40.  
  41. }
  42.  
  43.     cout << "\nEnd of program...";
  44.  
  45.     return 0;
  46.  
  47. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top