Write a C++ program that: asks for and accepts the Percentage earned with as a double (i.e. 75.45) rounds it to an integer (>= .5 rounds up, <.5 rounds down.) prints the original Percentage and the corresponding Grade and Points exactly as shown below. prints an error message for any input that is less than 0 or greater than 100. For example, if user enters 89.4, the program prints out: Percentage: 89.4% Grade: B Points: 3.00 You must use an if-else statement to do this in your program. Use fixed and precision output manipulators (see Ch. 3) to display the values with the exact precision shown above. IMPORTANT: Each if statement condition should contain only one comparison! read this again This means code that is similar to this is NOT okay: if (Percentage >= 80.00 && Percentage <90.00) This code is not acceptable because the if statement condition above has two comparisons. (Hint: If you order your if-else chain statements correctly, you will only need one comparison in each.) |
|
|
So my issue here is the rounding, and then theres the converting the double percetnage to an integer. |
|
|
cout <<setiosflags(ios::fixed)<<std::round(percentage)<< "What is the percentage of your grade?\n";