Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- using namespace std;
- int main()
- {
- int guess, r;
- double count = 0;
- int loop = 0;
- int level = 1;
- int a = 10;
- int b = 1;
- int points = 0;;
- srand(time(0));
- r = rand() % a + b;
- while (loop == 0)
- {
- cout << "NOTE: Press Ctrl + Z to end the game." << endl << endl;
- cout << "Level: " << level << endl;
- cout << "Points: " << points << endl;
- cout << "I'm thinking of a number between " << b << " and " << a << ":";
- cin >> guess;
- ++count;
- system("CLS");
- if (cin.eof())
- {
- cout << "Level Reached: " << level << endl;
- cout << "Total Points: " << points << endl;
- cout << "Guess Ratio: " << level/count << endl;
- system("PAUSE");
- return(0);
- }
- if (guess == r)
- {
- cout << guess << " is correct." << endl << endl;
- r = rand() % a + b;
- ++level;
- a = a + 5;
- points = points + 1000;
- continue;
- }
- if (guess < r)
- {
- cout << guess << " is lower than the number I'm thinking of." << endl << endl;
- points = points - 100;
- continue;
- }
- if (guess > r)
- {
- cout << guess << " is higher than the number I'm thinking of." << endl << endl;
- points = points - 100;
- continue;
- }
- else
- {
- system("CLS")
- continue;
- }
- return(0);
- }
- }
- while (loop == 0)
- {
- cout << "NOTE: Press Ctrl + Z to end the game." << endl << endl;
- cout << "Level: " << level << endl;
- cout << "Points: " << points << endl;
- cout << "I'm thinking of a number between " << b << " and " << a << ":";
- cin >> guess;
- ++count;
- system("CLS");
- if (cin.eof())
- {
- cout << "Level Reached: " << level << endl;
- cout << "Total Points: " << points << endl;
- cout << "Guess Ratio: " << level/count << endl;
- system("PAUSE");
- return(0);
- }
- if (guess == r)
- {
- cout << guess << " is correct." << endl << endl;
- r = rand() % a + b;
- ++level;
- a = a + 5;
- points = points + 1000;
- continue;
- }
- if (guess < r)
- {
- cout << guess << " is lower than the number I'm thinking of." << endl << endl;
- points = points - 100;
- continue;
- }
- if (guess > r)
- {
- cout << guess << " is higher than the number I'm thinking of." << endl << endl;
- points = points - 100;
- continue;
- }
- return(0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement