Letter Grade

Letter Grade - grade = 2.7 else if(letterGrade ==...

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

View Full Document Right Arrow Icon
Sheet1 Page 1 /****************************************************************************** Aria Mavvaji Sunayana Chopra Tadio ******************************************************************************/ #include <iostream> #include <string> #include <iomanip> using namespace std int main() { string letterGrade double grade d cout << "Enter your letter grade, may include + or -: " getline(cin,letterGrade) if(letterGrade == "A" || letterGrade == "a") grade = 4.0 else if(letterGrade == "A-" || letterGrade == "a-") grade = 3.7 else if(letterGrade == "B+" || letterGrade == "b+") grade = 3.3 else if(letterGrade == "B" || letterGrade == "b") grade = 3.0 else if(letterGrade == "B-" || letterGrade == "b-")
Background image of page 1

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

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

Unformatted text preview: grade = 2.7 else if(letterGrade == "C+" || letterGrade == "c+") grade = 2.3 else if(letterGrade == "C" || letterGrade == "c") grade = 2.0 else if(letterGrade == "C-" || letterGrade == "c-") grade = 1.7 else if(letterGrade == "D+" || letterGrade == "d+") grade = 1.3 else if(letterGrade == "D" || letterGrade == "d") grade = 1.0 else if(letterGrade == "D-" || letterGrade == "d-") grade = 0.7 else if(letterGrade == "F" || letterGrade == "f") grade = 0.0 else { cout << "Error. Invalid letter grade." <<endl return 1 } cout << "The numeric value is " << fixed << setprecision(1) << grade << endl return 0 Sheet1 Page 2 }...
View Full Document

This note was uploaded on 04/14/2008 for the course CSI 1430 taught by Professor Aars during the Spring '08 term at Baylor.

Page1 / 2

Letter Grade - grade = 2.7 else if(letterGrade ==...

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