Question

#include <iostream> using namespace std; int main () { } Write a program that converts a...

#include <iostream>

using namespace std;

int main ()

{

}

Write a program that converts a numeric score (provided by the user) into a letter grade (A, B, C, D, or F).

The point-to-letter conversion rules are as follows:

  • score >= 90: A

  • score >= 80 (but less than 90): B

  • score >= 70 (but less than 80): C

  • score >= 60 (but less than 70): D

  • otherwise: F

The completed program should produce console content as follows:

Enter your score: [user-specified number] [user-specified number] converts to: [corresponding letter grade]

For example, on input of 84.7, execution of the program should result in the following console content:

Enter your score: 84.7 84.7 converts to: B 
0 0
Add a comment Improve this question Transcribed image text
Answer #1

code:

#include<iostream>
using namespace std;
int main(){
   double score;
   cout<<"Enter your score:";
   cin>>score;
   if(score>=90){
       cout<<score<<" converts to: A";
   }
   else if(score>=80 && score<90){
       cout<<score<<" converts to: B";
   }
   else if(score>=70 && score<80){
       cout<<score<<" converts to: C";
   }
   else if(score>=60 && score<70){
       cout<<score<<" converts to: D";
   }
   else{
       cout<<score<<" converts to: F";
   }
   return 0;
}

--------------------------------------------------------------------------------------------------------------------------------

code with proper indentation

output:

Add a comment
Know the answer?
Add Answer to:
#include <iostream> using namespace std; int main () { } Write a program that converts a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT