Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Why is this not giving me a letter grade when run? #include #include using namespace std; int main() { double grade1, grade2, grade3, grade4, total;

Why is this not giving me a letter grade when run?

#include #include

using namespace std;

int main() { double grade1, grade2, grade3, grade4, total;

cout << "please enter the first grade : "; cin >> grade1; cout << "Please enter the second grade : "; cin >> grade2; cout << "Please enter the third grade : "; cin >> grade3; cout << "Please enter the fourth grade : "; cin >> grade4;

total = (grade1 + grade2 + grade3 + grade4) / 4;

cout << "The average grade is : " << setprecision(6) << total << endl;

const int A_score = 90, B_score = 80, C_score = 70, D_score = 60;

int testScore;

cin >> testScore;

if (testScore >= A_score) cout << "Your grade is A. "; else if (testScore >= B_score) cout << "Your grade is B. "; else if (testScore >= C_score) cout << "Your grade is C. "; else if (testScore >= D_score) cout << "Your grade is D. "; else if (testScore >= 0) cout << "Your grade is F. "; else cout << "invalid test score. ";

return 0; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Murach's SQL Server 2012 For Developers

Authors: Bryan Syverson, Joel Murach, Mike Murach

1st Edition

1890774693, 9781890774691

More Books

Students also viewed these Databases questions

Question

What is block ownership? How does it affect corporate governance?

Answered: 1 week ago