loops and calculations

I am totally new to this. I need to be able to add up all the inputs associated with the courses selected. How many credits and grade points and GPA. We are using vocareum for the course IDE. The prof has inputted the amounts for each when called for. Here is the output I should get when running the program, followed by my coding. I am just stumped. In my coding, I probably have too many variables declared but that's the least of my concerns. Thank you for any pointers.

The wanted output:
Enter a course name: CMPSC 101
Enter number of credits: 3
Enter you grade (A, B, C, D, F): A
Continue ('Yes' or 'No')? Yes
Enter a course name: BIO 100
Enter number of credits: 3
Enter you grade (A, B, C, D, F): B
Continue ('Yes' or 'No')? Yes
Enter a course name: ACCT 50
Enter number of credits: 1
Enter you grade (A, B, C, D, F): D
Continue ('Yes' or 'No')? No
Total grade points: //(I need this)
Total credits attempted: //(I need this)
Your GPA is //(I need this)



//Module 7 stretch

#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int main () {
cout<<std::fixed<<std::setprecision(2);

string grade;
string name;
string answer="Yes";
int totalcredits;
int gradepoints=0;
int credits=0;
double GPA;

while (answer=="Yes"){
cout<< "Enter a course name: " ;
getline(cin,name);
cout<<name;

cout<<endl;

cout<< "Enter number of credits: ";
cin >> credits;
cout << credits << endl;

cout<< "Enter you grade (A, B, C, D, F): ";
cin >> grade;
cout <<grade << endl;


cout<< "Continue ('Yes' or 'No')? ";
cin >> answer;
cin.ignore();
cout << answer << endl;

}


cout<<"Total grade points: ";

cout<< endl;

cout<<"Total credits attempted: ";

cout<<endl;

cout<<"Your GPA is ";

cout<< endl;

return 0;
}
Topic archived. No new replies allowed.