rorschack

c++ prac prog - 14

Aug 3rd, 2015
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. void main()
  2. {
  3.     clrscr();
  4.     char c;
  5.     int nof,grace(0);
  6.     cout << "Enter your class(f - first/s - second/t - third): ";
  7.     cin >> c;
  8.     cout << endl << "\nEnter the number of failed subjects: ";
  9.     cin >> nof;
  10.     switch(c)
  11.     {
  12.         case 'f':
  13.             grace = nof>3?0:3;
  14.             break;
  15.         case 's':
  16.             grace = nof>2?0:4;
  17.             break;
  18.         case 't':
  19.             grace = nof!=1?0:5;
  20.             break;
  21.     }
  22.     if(grace==0)
  23.         cout << endl << "\nYou are not eligible for grace marks.\n";
  24.     else
  25.         cout << endl << "\nYou get " << grace << " marks per subject as grace.\n";
  26.     getch();
  27. }
Advertisement
Add Comment
Please, Sign In to add comment