You are working on problem set: PS4 (Pause) Pause) i percentageGrade Language/Type: Related Links: C++ basics if/else interactive programs simpio.h What's wrong with the following code? Modify it to produce the intended output. Make sure to properly utilize if/else/if statements to avoid redundancy and avoid unnecessary tests. Do not use && or II in your solution. What percentage did you earn? 87 You got a B! 1 int percent= getInteger ("What percentage did you earn? "); 2 if (percent >= 98) { 3 cout << "You got an A!" << endl; 4) 5 if (percent >= 88) ( 6 cout << "You got a B!" << endl; 7) 8 if (percent >= 78) { 9 18) cout<< "You got a C!" << endl; 11 if (percent >= 68) { 12 cout << "You got a D!" << endl; 13) 14 if (percent < 68) { 15 16) Bare code. Write a fragment of C++ code as described, without any main function or heading around your code. ✔Submit cout << "You got an F!" << endl;

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter5: Control Structures Ii (repetition)
Section: Chapter Questions
Problem 27SA
icon
Related questions
Topic Video
Question
100%

solve the problem from the image. 

You are working on problem set: PS4 Pause) i
> percentageGrade ♡
Language/Type:
Related Links:
C++ basics if/else interactive programs
simpio.h
What's wrong with the following code? Modify it to produce the intended output. Make sure to properly utilize
if/else/if statements to avoid redundancy and avoid unnecessary tests. Do not use && or II in your solution.
What percentage did you earn? 87
You got a B!
1 int percent = getInteger ("What percentage did you earn? ");
2 if (percent >= 90) {
3
4}
5 if (percent >= 80) {
6
cout << "You got an A!" << endl;
cout << "You got a B!" << endl;
7}
8 if
9
10 }
11 if (percent >=60) {
12
13}
14 if
15
16 }
Bare code. Write a fragment of C++ code as described, without any main function or heading around your code.
(percent >= 70) {
cout << "You got a C!" << endl;
cout << "You got a D!" << endl;
(percent < 60) {
cout << "You got an F!" << endl;
Submit
Transcribed Image Text:You are working on problem set: PS4 Pause) i > percentageGrade ♡ Language/Type: Related Links: C++ basics if/else interactive programs simpio.h What's wrong with the following code? Modify it to produce the intended output. Make sure to properly utilize if/else/if statements to avoid redundancy and avoid unnecessary tests. Do not use && or II in your solution. What percentage did you earn? 87 You got a B! 1 int percent = getInteger ("What percentage did you earn? "); 2 if (percent >= 90) { 3 4} 5 if (percent >= 80) { 6 cout << "You got an A!" << endl; cout << "You got a B!" << endl; 7} 8 if 9 10 } 11 if (percent >=60) { 12 13} 14 if 15 16 } Bare code. Write a fragment of C++ code as described, without any main function or heading around your code. (percent >= 70) { cout << "You got a C!" << endl; cout << "You got a D!" << endl; (percent < 60) { cout << "You got an F!" << endl; Submit
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 1 images

Blurred answer
Knowledge Booster
Instruction Format
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning