c++gpa - /* Fanny Yang, CMPSC101 October 23, 2007 Prompt...

Info iconThis 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<<"? "; cin>>numCredits2;
Background image of page 1

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

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

Page1 / 4

c++gpa - /* Fanny Yang, CMPSC101 October 23, 2007 Prompt...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online