Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This C++ program for a class doesnt show any debugging errors but whenevr I run

ID: 3880876 • Letter: T

Question

This C++ program for a class doesnt show any debugging errors but whenevr I run it, all I get is a blank black screen with a bliking cursor. Any idea why the program isnt working properly?

************************************************************************************

#include

#include

using namespace std;

int main()

{

ifstream finput("mp2accept.txt");

char school;

double GPA;

int math, verbal;

char alumni;

int SAT;

int i = 0;

int countLA = 0;

int countM = 0;

while (!finput.eof())

{

finput >> school >> GPA >> math >> verbal >> alumni;

SAT = math + verbal;

if (school == 'L')

{

cout << "Applicant#:"<

cout << " School: Liberal Arts ";

cout << "GPA: " << GPA << endl;

cout << "SAT Score: " << SAT << endl;

cout << " Alumni: " << alumni << endl;

cout << "Result: ";

i++;

}

if (school == 'M')

{

cout << "Applicant#:"<

cout << " School: Music ";

cout << "GPA: " << GPA << endl;

cout << "SAT Score: " << SAT << endl;

cout << "Alumni: " << alumni << endl;

cout << "Result: ";

i++;

}

if (alumni == 'Y')

{

if(SAT < 1000)

{

cout << "Rejected - SAT is too low ";

continue;

}

if (GPA < 3)

{

cout << "Rejected - GPA is too low ";

continue;

}

}

else if (alumni == 'N')

{

if (SAT < 1200)

{

cout << "Rejected - SAT is too low ";

continue;

}

if (GPA < 3.5)

{

cout << "Rejected - GPA is too low ";

continue;

}

}

if (school == 'L')

{

if (countLA < 5)

{

cout << "Accepted into Liberal Arts!! ";

countLA++;

continue;

}

else

{

cout << "Rejected - Seats filled for Liberal Arts ";

continue;

}

}

else if (school == 'M')

{

if (countM < 3)

{

cout << "Accepted into Music!! ";

countM++;

continue;

}

else

{

cout << "Rejected, Seats filled for Music ";

continue;

}

}

}

finput.close( );

return 0;

***********************************************************************************************************************

File Data:

L 4.0 600 650 N
M 3.9 610 520 N
L 3.8 590 600 N
L 3.0 600 600 Y
L 3.4 600 600 N
L 3.0 500 490 Y
L 2.9 500 500 Y
M 3.5 500 490 Y
M 3.9 490 600 Y
L 3.5 700 500 N
L 3.1 600 400 Y
L 3.0 490 510 Y
L 4.0 800 800 Y
M 3.2 500 500 N

DMachine Pioblem 2-Microsclt Visual Studo uuckaunch1- Local Windows Debugger Salubon Ep orer e mairo search, Solution plorer :Ctrl+J include ciostroas -leader F les ouble ePA ins nats, verhsl: nti- f (achonl cout e school Liberal Arts'n cout Result: Shom ouput fromt Buid

Explanation / Answer

update it you havent included any headers files in this!

#include<bits/stdc++.h> // it includes most of the headers files

using namespace std;

int main()

{

ifstream finput("mp2accept.txt");

char school;

double GPA;

int math, verbal;

char alumni;

int SAT;

int i = 0;

int countLA = 0;

int countM = 0;

while (!finput.eof())

{

finput >> school >> GPA >> math >> verbal >> alumni;

SAT = math + verbal;

if (school == 'L')

{

cout << "Applicant#:"<

cout << " School: Liberal Arts ";

cout << "GPA: " << GPA << endl;

cout << "SAT Score: " << SAT << endl;

cout << " Alumni: " << alumni << endl;

cout << "Result: ";

i++;

}

if (school == 'M')

{

cout << "Applicant#:"<

cout << " School: Music ";

cout << "GPA: " << GPA << endl;

cout << "SAT Score: " << SAT << endl;

cout << "Alumni: " << alumni << endl;

cout << "Result: ";

i++;

}

if (alumni == 'Y')

{

if(SAT < 1000)

{

cout << "Rejected - SAT is too low ";

continue;

}

if (GPA < 3)

{

cout << "Rejected - GPA is too low ";

continue;

}

}

else if (alumni == 'N')

{

if (SAT < 1200)

{

cout << "Rejected - SAT is too low ";

continue;

}

if (GPA < 3.5)

{

cout << "Rejected - GPA is too low ";

continue;

}

}

if (school == 'L')

{

if (countLA < 5)

{

cout << "Accepted into Liberal Arts!! ";

countLA++;

continue;

}

else

{

cout << "Rejected - Seats filled for Liberal Arts ";

continue;

}

}

else if (school == 'M')

{

if (countM < 3)

{

cout << "Accepted into Music!! ";

countM++;

continue;

}

else

{

cout << "Rejected, Seats filled for Music ";

continue;

}

}

}

finput.close( );

return 0;

}

output:

GPA: 3
SAT Score: 1000
Alumni: Y
Result: Accepted into Liberal Arts!!

Applicant#:
School: Liberal Arts
GPA: 4
SAT Score: 1600
Alumni: Y
Result: Rejected - Seats filled for Liberal Arts

Applicant#:
School: Music
GPA: 3.2
SAT Score: 1000
Alumni: N
Result: Rejected - SAT is too low

Applicant#:
School: Music
GPA: 3.2
SAT Score: 1000
Alumni: N
Result: Rejected - SAT is too low

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote