Also, how do I do this? ------->
Various invalid and valid numbers No matter how many invalid numbers you enter your program should run with 5 valid input values.
Simply decrement counter whenever you get an invalid number.
1 2 3 4 5 6 7
counter++;
if ((num > 10) || (num < 1))
{
cout << "That is an invalid number.";
cout << endl;
counter--;
}
Do you mean that the program should ask for a valid number and, if the number entered is valid, print out that amount of $s and then exit after the 5th time?
I understood that, the part that threw me for a loop (pun intended) was:
asm103940 wrote:
Also, how do I do this? ------->
Various invalid and valid numbers No matter how many invalid numbers you enter your program should run with 5 valid input values.
I think the OP is supposed to ask for a number of $s to output 5 times and then exit the program as opposed to just ask/output once (original code seems to attempt this).