I'm confused as to how call a function. I know I'm doing it wrong, but I can't find anything that describes how to call it. I want main to call isInvalid to determine if input is invalid. Once its determined I want main to take invalid input and do one thing and take valid input and do another thing.
bool isInvalid (int grade, int hoursWorked, int IDnum) {
constint MIN_GRADE = 0; //minimum grade
constint MAX_GRADE = 2; //maximum grade
constint MAX_ID_NUM = 999999; //maximum ID number
constint MAX_HOURS = 80; //maximum hours that can be worked
if ((grade < MIN_GRADE) || (grade > MAX_GRADE) || (IDnum > MAX_ID_NUM) ||
(hoursWorked > MAX_HOURS))
return = true;
else {
return = false;
}
you can then treat the function call as if it were a boolean.
Since it's boolean, you can simplify the If..Else as there is no need to check the value in the else - if it is not true, it must be false.