Hello. I am new to programming and cant seem to figure out this project. i need to have the program end if 2 invalid inputs ( valid is 0.00 - 100.00)are entered for the same variable. it will also need to display a warning after the first invalid input is entered and returns so that the user can place the second input, and display text after the 2nd invalid input and will end the program.
If you want the actual word document let me know and i can get it to you.
Here is the project details
Problem: DESIGN and COMPLETE a program ACCORDINGLY that determines final letter grade for a student with encouraging comment. Three exams and two assignment scores as well as the student name will be entered by the user. Every score should range from 0.00 – 100.00. The program will give user only one chance to correct invalid score and provide meaningful feedback. Exams and assignments have equal weights for the final score (i.e. 50% by each category) that determines the final grade.
i trimmed the code i have so far. if you need all the code then let me know.
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
i need to have the program end if 2 invalid inputs ( valid is 0.00 - 100.00)are entered for the same variable. it will also need to display a warning after the first invalid input is entered and returns so that the user can place the second input, and display text after the 2nd invalid input and will end the program.
// Print the prompt and get a value. Make sure it's between 0 and 100
// (inclusive). If there's a problem then try one more time. On success,
// return true and set val. On failure, return false and val is undefined.
bool getPercent(constchar *prompt, double &val)
{
for (int i=0; i<2; ++i) {
cout << prompt << ' ';
if (cin >> val &&
val >= 0.0 && val <= 100.0) returntrue;
}
returnfalse;
}