Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main ()
- {
- long int studentNum;
- double termMark;
- int count=12;
- int infinite=1;
- char letterGrade;
- cout << "Hello, Welcome to Student Information System Version 1. Please enter -1 if you want to exit the program"<<endl;
- while (infinite<count)
- {
- do
- {
- cout << "Please enter your 9 digit student number: ";
- cin >> studentNum;
- if (studentNum==-1)
- {
- cout << "Thank you";
- return 0;
- }
- } while( (studentNum<100000000) || (studentNum>999999999));
- do
- {
- cout << "Enter your grade (your grade must be between 0 and 100): ";
- cin >> termMark;
- } while (termMark<0 || termMark>100);
- if (termMark >85.5)
- {
- letterGrade = 'A';
- }
- else
- {
- if (termMark>73.5)
- {
- letterGrade= 'B';
- }
- else
- {
- if (termMark>61.5)
- {
- letterGrade= 'C';
- }
- else
- {
- if(termMark>49.5)
- {
- letterGrade= 'D';
- }
- else
- {
- letterGrade= 'F';
- }
- }
- }
- }
- cout.setf(ios::fixed);
- cout.setf(ios::showpoint);
- cout.precision(2);
- cout << "Student Number: " << studentNum << ", percentage grade: " << termMark << "." << endl;
- cout << "This student will recieve a"; if(letterGrade =='A'){cout<<"n ";} else {cout<<" ";} cout << letterGrade << "."<< endl;
- }
- }
Add Comment
Please, Sign In to add comment