Question: Intro to C++ This below has the code I made, but when I tried to run through Vocareum, I kept getting an error. could you

Intro to C++

Intro to C++ This below has the code I made, but when

This below has the code I made, but when I tried to run through Vocareum, I kept getting an error. could you tell me what I did wrong?

#include

#include

#include

using namespace std;

string course, grade;

string answer="YES";

int gpa, point = 0;

int credit = 0;

int tpoint = 0;

int gpoint = 0;

int tcredit = 0;

float tgpa = 0;

int main() {

cout

cin.ignore(-1)

getline(cin,course);

cout

cout

cout

cin>>credit;

cout

cout

tcredit = tcredit + credit;

cout

cin>>grade;

cout

cout

if (grade=="A") {

point=4;

}

if (grade=="B") {

point=3;

}

if (grade=="C") {

point=2;

}

if (grade=="D") {

point=1;

}

if (grade=="F") {

point=0;

}

cout

cin>>answer;

cout

cout

while (answer=="Yes") {

cout

cin.ignore();

getline(cin,course);

cout

cout

cin>>credit;

cout

tcredit = tcredit + credit;

cout

cin>>grade;

cout

if (grade=="A"){

point=4;

}

if (grade=="B"){

point=3;

}

if (grade=="C") {

point=2;

}

if (grade=="D") {

point=1;

}

if (grade=="F") {

point=0;

}

tpoint += (point*credit);

cout

cin>>answer;

cout

}

cout

cout

cout

cout

tgpa=(double)tpoint/(double)tcredit;

cout

cout

return 0;

}

#include

#include

#include

using namespace std;

string course, grade;

string answer="YES";

int gpa, point = 0;

int credit = 0;

int tpoint = 0;

int gpoint = 0;

int tcredit = 0;

float tgpa = 0;

int main() {

cout

cin.ignore(-1)

getline(cin,course);

cout

cout

cout

cin>>credit;

cout

cout

tcredit = tcredit + credit;

cout

cin>>grade;

cout

cout

if (grade=="A") {

point=4;

}

if (grade=="B") {

point=3;

}

if (grade=="C") {

point=2;

}

if (grade=="D") {

point=1;

}

if (grade=="F") {

point=0;

}

cout

cin>>answer;

cout

cout

while (answer=="Yes") {

cout

cin.ignore();

getline(cin,course);

cout

cout

cin>>credit;

cout

tcredit = tcredit + credit;

cout

cin>>grade;

cout

if (grade=="A"){

point=4;

}

if (grade=="B"){

point=3;

}

if (grade=="C") {

point=2;

}

if (grade=="D") {

point=1;

}

if (grade=="F") {

point=0;

}

tpoint += (point*credit);

cout

cin>>answer;

cout

}

cout

cout

cout

cout

tgpa=(double)tpoint/(double)tcredit;

cout

cout

return 0;

}

INSTRUCTIONS In this problem, you will be prompting a student for grades and credits for courses taken. From that, you will calculate a GPA This site: http://www.back2college.com/gpa.htm shows you how to calculate a GPA Keep prompting the student if they want to add more courses IMPORTANT NOTES! The course name is prompted for, but nothing is done with it We are just using the grades A, B, C, D, and F so you won't have to do so much typing! . You will need to use the "set precision" command as shown in the book. Set it to "fixed" and "2". You will need to use the "cin.ignoreO" function as discussed earlier in the course

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!