Hey there again my fellow coders;
I seem to be getting stuck on something. Here is what I've got to do:
1. seed the random number generator
2. generate a target number between 0 and 99
3. loop
a. prompt the user to enter a guess between 0 and 99
b. read the guess
c. if the guess and the target number are equal
i. print a success message (e.g., “Right” or “You Win”)
ii. break out of the loop
d. if the guess is less than 0, break out of the loop (a way to quit early)
e. if the guess is less than the target number, print “Low”
f. if the guess is greater than the target number, print “High”
here is what i have so far:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
#include <iostream>
#include <stdlib.h>
#include <time.h>
using namespace std;
int main ()
{
int Guess;
int Answer;
srand((unsigned)time(NULL)); // seed the generator
int target = rand() % 100; // numbers [0..99]
do
{
cout << "Pick a number between 0 and 99: " << endl;
cin >> Guess;
if (Guess == Answer)
cout << "Correct! You Win!!"<< endl;
exit (0);
else (Guess = 0)
cout << "Pick a number larger than Zero; Terminating program" <<endl;
exit (0);
else Guess > Answer)
cout
}
return 0;
}
|
im getting an error with my else if or else ( and at the bottom too ) i don't know how to fix it