// This program uses a switch-case statement to assign a
//letter grade (A, B, C, D, or F) to a number test score.
#include<iostream>
using namespace std;
int main()
{
char grade; int testScore = 10;
cout << "Enter your test score and I will tell you\n";
cout << "the letter grade you earned: ";
cin >> grade;
switch (testScore)
{
case 10:
case 5:
testScore < 60.0;
cout << "Your grade is f.\n";
break;
case 6:
testScore >= 70.0;
cout << "Your grade is D.\n";
break;
case 7:
testScore >= 80.0;
cout << "Your grade is C.\n";
break;
case 8:
testScore >= 90.0;
cout << "Yor grade is B.\n";
break;
case 9:
testScore <= 100.0;
cout << "Your grade is A.\n";
break;
default:
cout << "That score isn't valid.\n";
return 0;
}
}
Ama_1 0 Newbie Poster
AssertNull 1,094 Practically a Posting Shark
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.