I have gotten started on my while loop but I'm kinda stuck I dont know where to go from here :(
My assignment is to write a program to read in 6 numbers from the keyboard and then indicate whether any of them were larger than 500 or smaller than 10.
After that I need to add in a flag that will detect numbers larger than 500. Use a bool variable for this.
Then add in a flag that will detect numbers less than 10. Use a bool variable for this.
The feedback to the user should happen after (outside) the end of the loop, not during the input phase. The user is not interested in how many times an event occurred, only whether it happened or not. The feedback should have clear messages telling the user whether each event occurred or not; it should NOT just be the word 'true' or 'false' or 1 or 0.
And this is all I have gotten so far :( .... Im just not cut out for computer science
#include <iostream>
using namespace std;
int main ()
{
int num;
int ctr = 0;
cout << " **** A Flag question ****" << endl;
cout << endl;
cout << "Please Enter 6 numbers";
while ( ctr < 7 )
cin >> num;
if (num > 500 || num < 10)
return true;
else
return false;
ctr ++;
return 0;
Thanks guys
-UKmason