Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication1.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <iostream>
- #include <string>
- #include <fstream>
- // an example of a prime number is a number that is only divisible by its self and 1
- using namespace std;
- int main()
- {
- ifstream fin;
- string schoolcode;
- float gpa;
- float mathscore;
- float verbalscore;
- string isalum;
- float usersumsat;
- float count = 0;
- float countnumber = 0;
- float countnumber2 = 0;
- fin.open("C:\\temp\\mp3accept.txt");
- while (!fin.eof())
- {
- fin >> schoolcode >> gpa >> mathscore >> verbalscore >> isalum;
- cout << "Applicant Number: " << count << endl;
- count = count + 1;
- cout << "School: " << schoolcode << " GPA: " << gpa << " Math: " << mathscore << " Verbal: " << verbalscore << " Alumnus: " << isalum << endl;
- if (schoolcode == "M" && mathscore >= 500 && verbalscore >= 500) {
- cout << "You Applied To Music!" << endl;
- cout << "You Were Accepted!" << endl;
- countnumber = countnumber + 1;
- }
- else if (schoolcode == "L" && isalum == "Y") {
- if (gpa >= 3) {
- usersumsat = verbalscore + mathscore;
- if (usersumsat >= 1000)
- {
- cout << "You Applied to Libral Arts" << endl << "You Were Accepted To Libral Arts" << endl;
- countnumber2 = countnumber2 + 1;
- }
- else {
- cout << "You Applied to Libral Arts" << endl << "You failed because of your SAT" << endl;
- }
- }
- else {
- cout << "You Applied to Libral Arts" << endl << "You failed because of your GPA" << endl;
- }
- }
- else if (schoolcode == "L" && isalum == "N") {
- usersumsat = mathscore + verbalscore;
- if (gpa >= 3.5)
- {
- if (usersumsat >= 1200)
- {
- cout << "You Applied to Libral Arts" << endl << "You Were Accepted!" << endl;
- countnumber2 = countnumber2 + 1;
- }
- else
- {
- cout << "You Applied to Libral Arts" << endl << "You failed because of your SAT" << endl;
- }
- }
- else {
- cout << "You Applied to Libral Arts" << endl << "You Failed because of your GPA." << endl;
- }
- }
- else {
- cout << "You Applied to Libral Arts" << endl << "You failed because of your SAT" << endl;
- }
- cout << "============================================" << endl;
- }
- cout << "There were " << count << " applicants in the file." << endl;
- cout << "There were " << countnumber << " acceptances to music." << endl;
- cout << "There were " << countnumber2 << " acceptances to libral arts." << endl;
- fin.close();
- // this is going to pause the program
- system("pause");
- // this is going to close the program out
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment