The Random Number Guessing Game

I having problems putting this game together for class, i am very new to this thing. please assist!!!
here is what is needed:

The Random Number Guessing Game
You and a partner will be writing a number guessing game. In your game, the player will choose a number from 1 to 100. You will tell the user if the number is too high or too low and they will continue to guess until they guess the correct number. The user should also be allowed to play the game as many times as he/she wishes.

Use the following menu to drive your program:
1) See Rules
2) Play Game
3) Exit

Input validation: The menu choice must be 1, 2 or 3. The user must enter a number between 1 and 100.
Create an algorithm called randomnumberalg.txt and a program called randomnumber.cpp and save in your classwork/classwork3 folder.

Grading Rubric:
1) Algorithm (15) ______
2) User friendly introduction with clear directions. (1) ______
3) Your number must be randomly generated by the computer. (2) ______
4) Keep track of the user guesses with a counter. (2) ______
• Reset counter each time game is played
5) Loop until the user guesses the correct number. Display whether the guess is too high or too low.
(8) ______
6) Create a scoring system. For example, 0-3 guesses = Great, 4-6 = Good, etc. Display the user’s score at the end of the program. (4) ______
7) Loop to play as many times as user wishes. (4) ______
8) Input validation (4) ______
• Menu choice
• User entry between 1 and 100


here is my code:
#include<iostream>
#include<time.h>
using namespace std;

int main()

{

int Guesses = 5;
int Guess;
int Answer;
int choice = 0;

do
{

srand(time(NULL));
Answer = rand() % 100 + 1;

cout<<"Please choose from the following menu:\n";
cout<<"1) See Rules\n2) Play Game\n3) Exit\n\n";
cout<<"Enter your choice here: "<<endl;
cin>>choice;

if (choice == 1)
{
cout <<"Rules\n";
}
else if (choice == 2)
{

for (int i = 0; i < Guesses; i++)
{
cout << "Guess a number # " << i+1 << ": ";
cin >> Guess;

if (Guess != Answer)
{
if (Guess > Answer)
cout << "To High!!! \n"<<endl;
else
cout << "To Low!!! \n" <<endl;
}
else
{
cout << "YOU WON!!!\n."<<endl;
system("pause");
}
}
}

cout << "You Lost\n"<<endl;
cout << "The correct answer was: " << Answer << endl;


}

while(choice != 3);
system("pause");
return 0;
}
It looks like you are avoiding doing the biggest part of the assignment - writing your own random number generation algorithm (item 1). You should do that, as it is worth a lot of points (15/40).

Also, please put [code] code tags around your code [/code] to make it look nicer.
Topic archived. No new replies allowed.