Hello I'm a beginner C++ coder and currently taking Programming Structure class. The professor asked us to create a function that can validate the input numbers is correct form of number and limit the input numbers for pay rates to 99.99 and hours worked to 112.00. So far I am able to validate the pay rate to be 99.99 but instead of creating a whole new function to validate hours worked. I want to have the pay rate validation to also validate the hours worked as well. I want to know what I am missing to implement this code?
Thanks ahead of time.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
getValidatedNumber("Enter hourly pay rate: ",payrate);
getValidatedNumber("Enter hours worked this pay period: ",hours);
...
void getValidatedNumber (char *prompt,float *validatedNumber)
{
int reTryCount=0;
BOOLEAN ValidNumber;
do {
printf(prompt);
scanf("%f",validatedNumber);
ValidNumber = ValidateNumber(*validatedNumber,0,99.99);
if (!ValidNumber) reTryCount++;
} while (reTryCount < RETRYMAX && !ValidNumber);
if (reTryCount > RETRYMAX && !ValidNumber);