Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- #include <time.h>
- using namespace std;
- int rando, guess;
- int count = 1;
- int Attm =0;
- int main(){
- srand (time(0));
- rando = 1 + rand()% 100;
- cout << "Type a number between 1 and 100, hope you get it! " <<"\n";
- cin >> guess;
- while (guess != rando){
- if (guess < rando){
- Attm++;
- cout << "You guessed very low! Try again: " << "\n";
- cin >> guess;
- }
- else if (guess > rando){
- Attm++;
- cout << "You guessed very high! Try again: " << "\n";
- cin >> guess;
- }
- if (guess == rando){
- Attm++;
- cout << "You got it correct!" << "\n";
- cout << "In "<< Attm << " Tries!!" << endl;
- }
- //return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment