You are on page 1of 1

int main ()

randomize()

int choice

cout << "Welcome!" << endl


<< "Choose a difficulty: " << endl
<< "1) Easy (0-10)" << endl
<< "2) Medium (0-100)" << endl
<< "3) Hard (0-1000)" << endl
<< "4) Insane (0-10000): "

cin >> choice

Too lazy to map these values


to the options.
int upperLimit = 1 As a side effect, you can
have arbitrary difficulties
:P

int i = 1

i <= choice

True
False

upperLimit = 10 cout << upperLimit

i += 1 unsigned long int rand = random(upperLimit + 1), steps = 0, input

True
False
steps += 1

cout << "Enter a guess: "


False

cin >> input

input == rand

False
True

cout << "Well done!" << endl input > rand

True False

cout << "Number of guesses: " << steps << endl cout << "Too High" << endl input < rand

True

cin.get() cout << "Too Low" << endl

cin.get()

You might also like