for some reason, the while loop is preventing the player from playing the game. it compiles correctly.
Code:
#include <iostream.h>
#include <string>
int main()
{
float rnd;
float guess;
rnd = rand(20);
cout << "Welcome to the number game!" << endl;
cin.get();
cout << "Enter a number between 1 and 20" << endl;
int tries = 5;
while(tries >= 1);
{
cin >> guess;
if(guess < rnd)
{
cout << "Too low" << endl;
tries -= 1;
}
if(guess > rnd)
{
cout << "Too high" << endl;
tries -= 1;
}
if(guess == rnd)
{
cout << "You got it right!" << endl;
}
}
return 0;
}