Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- #include <ctime>
- #include <cstdlib>
- using namespace std;
- int main()
- {
- srand (time(NULL));
- // Variable declaration
- int guess;
- const int minimum = 1;
- const int maximum = 10;
- int range = maximum - minimum + 1;
- int num = rand() % range + minimum;
- int amountOfGuesses = 0;
- do{
- cout << "Pick a number between 1-10: " << endl;
- cin >> guess;
- amountOfGuesses++;
- if (guess<num)
- {
- cout << "Too low modafucka" << endl;
- }
- if (guess>num)
- cout << "Too high hahaaaha" << endl;
- }while(guess!=num);
- cout << "<<<CONGRATULATIONS>>>! You won!" << endl;
- cout << "It took u " <<amountOfGuesses<< " tries" << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement