You be prompting a student for grades and credits for


Computer Science - Intro to C++ Problem

You be prompting a student for grades and credits for courses taken. From that, you will calculate a GPA.

This site: https://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 Set it to "fixed" and "2".
  • You will need to use the "cin.ignore()" function as discussed earlier in the course.

This is what I have thus far:

#include

#include

using namespace std;

string course;

int credits;

string grade;

string answer;  

int main() {

  cout << "Enter a course name: ";

  getline(cin,course);

  cout << course;

  cout << endl;

   cout << "Enter number of credits: ";

  cin >> credits;

  cout << credits;

  cout << endl;

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

  cin >> grade;

  cout << grade;

  cout << endl;

  cout << "Continue ('Yes' or 'No')? ";

  cin >> answer;

  cout << answer;

  cout << endl;

  return 0;

}

Do I need a while loop to ask questions, and I am assuming a:

if(grade == "A"){

gradePoint = credit * 4;

}

What about the "set precision" to a fixed 2 value and "cin.ignore()" in the program?

Solution Preview :

Prepared by a verified Expert
Business Management: You be prompting a student for grades and credits for
Reference No:- TGS02711906

Now Priced at $20 (50% Discount)

Recommended (94%)

Rated (4.6/5)