Google
 
Webcprogramming.com




An Affiliate of AIHorizon




Guessing Game Solution

The following program will act as a guessing game in which the user has eight tries to guess a randomly generated number. The program will tell the user each time whether he guessed high or low:

#include <stdlib.h>
#include <iostream>

using namespace std;

int main() { int number=rand()___; int guess=-1; int trycount=0; while(guess__number __ trycount<8) { cout__"Please enter a guess: "; cin__guess; __(guess_number) cout<<"Too low"<<endl;
__(guess_number)
cout<<"Too high"<<endl; _______________; _ if(guess==number) cout<<"You guessed the number"; ____ cout<<"Sorry, the number was: "<<_____; ______ 0; _ Solution

-----
Interested in advertising with us?
Please read our privacy policy.
Copyright © 1997-2005 Cprogramming.com. All rights reserved.

Geodesy Designs