Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include<iostream>
- #include<cmath>
- #include<string>
- #include<fstream>
- using namespace std;
- int main()
- {
- ifstream fileInput;
- fileInput.open("E:\\docs\\C++\\mp3accept.txt");
- int applicantNumber = 0;
- char schoolCode;
- float gpa;
- int mathScore;
- int verbalScore;
- char Alum;
- int musicLimit = 0;
- int libartsLimit = 0;
- int totalSat;
- fileInput >> schoolCode >> gpa >> mathScore >> verbalScore >> Alum;
- while (!fileInput.eof())
- {
- applicantNumber++;
- cout << "Applicant #: " << applicantNumber << endl;
- cout << schoolCode << " " << gpa << " ";
- cout << mathScore << " " << verbalScore << " ";
- cout << Alum << endl;
- cout << endl;
- totalSat = mathScore + verbalScore;
- if (schoolCode == 'M')
- if (musicLimit == 3)
- cout << "Music Student Quota Met.";
- else if (mathScore >= 500 && verbalScore >= 500)
- {
- cout << "Qualified for admissions.";
- musicLimit++;
- }
- else if (mathScore < 500 || verbalScore < 500)
- cout << "Admission denied: Sat requirement not met.";
- else
- cout << "Invalid SAT.";
- else if (schoolCode == 'L')
- if (libartsLimit == 5)
- cout << "Liberal Arts Student Quota Met.";
- else if (Alum == 'Y')
- if (gpa >= 3.0 && totalSat >= 1000)
- {
- cout << "Qualified for admission.";
- libartsLimit++;
- }
- else if (gpa < 3.0 || totalSat < 1000)
- cout << "Admission denied: Sat or GPA requirements not met.";
- else
- cout << "Invalid SAT or GPA.";
- else if (Alum == 'N')
- if (gpa >= 3.5 && totalSat >= 1200)
- {
- cout << "Qualified for admission.";
- libartsLimit++;
- }
- else if (gpa < 3.5 || totalSat < 1200)
- cout << "Admission denied: Sat or GPA requirements not met.";
- else
- cout << "Invalid SAT or GPA.";
- else
- cout << "Incorrect alumni code.";
- else
- cout << "Incorrect school code";
- cout << "\n------------------\n" << endl;
- fileInput >> schoolCode >> gpa >> mathScore >> verbalScore >> Alum;
- }
- fileInput.close();
- cout << "There were " << applicantNumber << " applicants in the file.\n";
- cout << "There were " << libartsLimit << " acceptances to Liberal Arts.\n";
- cout << "There were " << musicLimit << " acceptances to Music.\n";
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement