We are learning to use the
srand(time(NULL))
rand()%11
function command things, and our teacher asked us to make a "game" so to speak where the user enters a number, then the computer trys to guess it, you have to use while loops also. I tried this. (number being the users entered number, compguess being the random number the computer picks)
int compguess = rand()%number;
while(compguess != number)
{
count = count + 1; //to keep the amount of guesses
cout<<compguess<<" was wrong"<<endl;
}
cout<<"The computer took "<<count<<" times"<<endl;
well that just gave me a big long scrolling list of one number being wrong, can someone please tell me how I could go about doing this a.s.a.p. sorry its so long.
while(compguess != number)
{
count = count + 1; //to keep the amount of guesses
cout<<compguess<<" was wrong"<<endl;
compguess = rand()%number;
}