daily pastebin goal
72%
SHARE
TWEET

Untitled

a guest Jan 22nd, 2019 59 Never
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.     long int studentNum;
  7.     double termMark;
  8.     int count=12;
  9.     int infinite=1;
  10.     char letterGrade;
  11.     cout << "Hello, Welcome to Student Information System Version 1. Please enter -1 if you want to exit the program"<<endl;
  12.     while (infinite<count)
  13.     {
  14.     do
  15.     {
  16.         cout << "Please enter your 9 digit student number: ";
  17.         cin >> studentNum;
  18.        
  19.         if (studentNum==-1)
  20.         {
  21.             cout << "Thank you";
  22.             return 0;
  23.         }
  24.     } while( (studentNum<100000000) || (studentNum>999999999));
  25.  
  26.     do
  27.     {
  28.         cout << "Enter your grade (your grade must be between 0 and 100): ";
  29.         cin >> termMark;
  30.     } while (termMark<0 || termMark>100);
  31.    
  32.     if (termMark >85.5)
  33.     {
  34.         letterGrade = 'A';
  35.     }
  36.     else
  37.     {
  38.         if (termMark>73.5)
  39.         {
  40.             letterGrade= 'B';
  41.         }
  42.         else
  43.         {
  44.             if (termMark>61.5)
  45.             {
  46.                 letterGrade= 'C';
  47.             }
  48.             else
  49.             {
  50.                 if(termMark>49.5)
  51.                 {
  52.                     letterGrade= 'D';
  53.                 }
  54.                 else
  55.                 {
  56.                     letterGrade= 'F';
  57.                 }
  58.             }
  59.         }
  60.     }
  61.  
  62.     cout.setf(ios::fixed);
  63.     cout.setf(ios::showpoint);
  64.     cout.precision(2);
  65.     cout << "Student Number: " << studentNum << ", percentage grade: " << termMark << "." << endl;
  66.     cout << "This student will recieve a"; if(letterGrade =='A'){cout<<"n ";} else {cout<<" ";} cout << letterGrade << "."<< endl;
  67.     }
  68.  
  69. }
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
 
Top