srand( 0 );
int points; // number of points
float computerNumber; // number generated by the computer
float guess; // user's guess
char quit; // What the user enters when they want to quit
int totalPoints; //the total score of all of the games played
int avgPoints; // the average score of all games played
int gamesPlayed; // how many games have been played
float rangeLow; // the lower end of the range
float rangeHigh; // the higher end of the range
points = 5;
quit = 'n';
gamesPlayed = 0;
totalPoints = 0;
while ( quit != 'q' )
{
gamesPlayed++;
cout << "Welcome to Guessing Game! \n";
points = 5;
cout << "What would you like your range to be? \n";
cout << "Low number: \n";
cin >> rangeLow;
cout << "High number: \n";
cin >> rangeHigh;
if ( rangeLow > rangeHigh )
{
cout << "Please use a high number that is greater than the low number. \n";
cout << "Low number: \n";
cin >> rangeLow;
cout << "High number: \n";
cin >> rangeHigh;
}
else
{
;
}
computerNumber = rand( ) % (rangeLow - rangeHigh + 1) + 10;
cout << "Computer Number: " << computerNumber << endl;
cout << "Points:" << points << endl;
cout << "what is your guess? \n" << endl;
cin >> guess;
cout << "Your guess is: " << guess << endl;
When I input this code (among other error-free lines of code that don't affect these lines), it won't compile and outputs two error messages- "expression must have integral or unscoped enum type" and "'%' is illegal, right operand has type 'float'"
I have a feeling that it has something to do with using variables in my equation, but that shouldn't be a problem? All of the variable types are float that have to do with this equation, and I'm pretty confused.