i have the program written but i am having troble with a few parts. i am supposed to have the number of tries on the screen (which i do) but i need the program to ask the player if they want to play again after the game is done and act accordingly. it also should display the number of games played, number of correct guesses and average number of guesses it took to get the right answer. i do not know where the codes should go or how to write them in. any help would greatly be appreciated. i have been trying to learn this stuff from the book examples. i hope i coded this the right way
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main ()
{
int num;
int guess;
bool done;
int noOfGuesses = 0;
int ncount;
num = (rand() + time(0)) % 1000;
done = false;
while ((noOfGuesses < 10) && (!done))
{
cout << "Enter an integer greater"
<< " than or equal to 0 and "
<< "less than 1000: ";
cin >> guess;
cout << endl;
noOfGuesses++;
if (guess == num)
{
cout << "you guessed the correct "
<< "number." << endl;
done = true;
}
else
if (guess < num)
cout << "Your guess is lower "
<< "than the number. \n"
<< "Guess again!" << endl;
else
cout << "Your guess is higher "
<< "than the number.\n"
<< "guess again!" << endl;
cout <<"Total gueses equal " << noOfGuesses << endl;
}
return 0;
}