Uroci.net - !

C++

C++ » C++
swink2003   :    : 2298

15

 #include

#include

#include


using namespace std;


int main()

{

 

  bool goOn=true;

  while(goOn)  

{

  srand(time(0));

  int number=rand()%1000+1;;

  int guess;

 

  char answer;

  cout<<"Im thinking of a number between 1-1000. Take a guess:";

  cin>>guess;

 

 

  while(guess!=number)

{

  if(guess>number)

{

  cout<<"Too high,guess again:";

  cin>>guess;

}

  if(guess

{

  cout<<"Too low,guess again:";

  cin>>guess;

}

}

if(guess==number)

{

  cout<<"Congratulations!! You Gusset The Number!";

}

  cout<<"Would you like to play again? Enter y or n";

  cin>>answer;

  if(answer!='y')

{

  goOn=false;

  cout<<"Thanks for playing.";  

}

}


return 0;

}

 



|

,


- © 2003-2010. .
: IT