Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <time.h>
- using namespace std;
- // game of guessing number;
- int main()
- {
- srand(time(0));
- int number;
- number = rand() % 100 + 1;
- int guess;
- do {
- cout <<"Enter your estimate guess: "<<flush;
- cin >> guess;
- if (guess < number){
- cout << "Your guess is less than the secret number" << endl;
- }
- else if (guess > number){
- cout << "Your guess is more than the secret number" << endl;
- }
- else{
- cout << "Your guess is right!" << endl;
- cout << "Congratulation!!!!!!!!" << endl;
- }
- }while(guess != number);
- system("PAUSE"); // prevent the consol from closing;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement