I am in a C++ class in college and i need some help with a project
It's a "guess the number game". i got it to work but the teacher said that it needs to be divided in to four separate functions and I have no clue how to do that. Plus i need to add a way to count how many times it runs through the loop and print a massage that says
if it's less then 10 " you know the secret or got lucky"
if it is ten " you know the secret"
and more then "10 you could have done better"
i really need some help please and thank you
here is my code
#include <cstdlib>
#include <iostream>
#include <time.h>
using namespace std;
int main()
{
srand (time(0));
int number;
number= rand () % 1000+1;
printf("Welcome to guess the number\n i'm think of a number between 1 and 1000");
int guess;
do {
cout << "\nenter your guess:";
cin >> guess;
if (guess < number)
cout << "\nyour number is to low guess again";
else if ( guess > number)
cout << "\nyour number is to high guess again";
else
cout <<"\nyour guess is correct! Congraulations!";
}while (guess != number);
system ("PAUSE");