Originally Posted by
Chaplin27
Hey everyone,
What I was trying to accomplish is I want to run the loop until a sentinel (is that the right word?) value is entered (in this case 0 or anything over 1000)
There's a bit redundancy, and maybe some logic problems, like what happens if they enter a negative number?
Code:
int main()
{
Prompt for amt_requested
Get amt_requested
WHILE (amt_requested > 0 ) AND (amt_requested <= 1000)
{
Prompt for interest_rate, loan_duration
Get interest_rate, loan_duration
... process amt or store it for later processing
Prompt for amt_requested
Get amt_requested //new amount or sentinel to end
} // ENDWHILE
}