////////////////////////////////////
//Alex Hill Lab4.cpp
////////////////////////////////////
//Discription: User plays a guessing
//game and the computer says if guess
//is higher or lower than number
//////////////////////////////////////
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int userguess, endgame;
int randomgen;
int random;
random = randomgen();
cout << "Guess a number from 1 to 1000 and play my game" << endl;
for (int counter = 1; counter > 11; counter++)
{
cout << "Start your guessing!";
cin >> userguess;
if (userguess == random)
endgame = 1;
if (endgame == 1)
counter = counter + 11;
if (userguess > random)
cout << "too high" << endl;
if (userguess < random)
cout << "too low" << endl;
}
if (endgame >= 11)
cout << "you can do better";
else
cout << "Good job!";
return 0;
}
int randomgen()
{
int randomgen;
int randomnumber;
randomnumber = 1 + rand() % 1000;
return randomnumber;
}