c++gpa - Fanny Yang CMPSC101 Prompt the user to enter 3...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
/* Fanny Yang, CMPSC101 October 23, 2007 Prompt the user to enter 3 courses, grades, and number of credits then display the grade and GPA*/ #include<iostream> #include<string> #include<iomanip> using namespace std; int main() { string course1, course2, course3; string letterGrade, letterGrade1, letterGrade2, letterGrade3; int numCredits1, numCredits2, numCredits3; double courseValue1, courseValue2, courseValue3; double GPA; cout<<"Enter in the following information. "<<endl<<endl; cout<<"Course 1: "; cin>>course1; cout<<"How many credits did you earn in "<<course1<<"? "; cin>>numCredits1; cout<<"What is the course value you received for "<<course1<<": "; cin>>courseValue1; if(courseValue1 >= 4.0) letterGrade1 = "A"; else if(courseValue1 >= 3.7) letterGrade1 = "A-"; else if(courseValue1 >= 3.5) letterGrade1 = "B+"; else if(courseValue1 >= 3.2) letterGrade1 = "B"; else if(courseValue1 >= 3.0) letterGrade1 = "B-"; else if(courseValue1 >= 2.5) letterGrade1 = "C+"; else if(courseValue1 >= 2.0) letterGrade1 = "C"; else if(courseValue1 >= 1.0) letterGrade1 = "D"; else letterGrade1 = "F"; cout<<"Course 2: "; cin>>course2; cout<<"How many credits did you earn in "<<course2<<"? ";
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern