I want a number to be assigned for each process or input. I think the code I have gives an illusion that it's doing that, but I don't think it is. So for this code, I want an entry1, and entry2, etc each time an entry is inputted.
#include <iostream>
usingnamespace std;
int countLow = 0, countHigh = 0;
bool process( int entry ) {
do { cout << "\n\nEnter number: ";
if ( cin >> entry ) {
if ( entry >= 1 && entry <= 100 && countLow < 5 ) {
cout << "Entry " << countLow + 1 << " for the low range has been filled.";
countLow++;
if ( countLow == 5 ) {
cout << "\nLow limit reached.";
}
}
elseif ( entry >= 901 && entry <= 1000 && countHigh < 5 ) {
cout << "Entry " << countHigh + 1 << " for the high range has been filled.";
countHigh++;
if ( countHigh == 5 ) {
cout << "\nHigh limit reached.";
}
}
else
cout << "Invalid number.";
}
else
cout << "Invalid input.\n";
cin.clear();
string temp;
getline(cin, temp);
} while ( countLow != 5 || countHigh != 5 );
}
int main() {
cout << "Please begin entering a series of numbers." << endl <<
"\nYou must have 2 sets of 5 numbers." << endl <<
"\n5 should be within the range of 1 and 100." << endl <<
"\nThe other set should be within the range of 901 and 1000" << endl;
double entry;
do {
process (entry);
break;
} while ( countLow == 5 && countHigh == 5 );
cout << "\n\nGame starting!";
}
I'm super sorry for posting the whole thing, but I don't know how to trim it.