Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cctype>
- #include <time.h>
- #include <conio.h>
- using namespace std;
- int main(){
- int z;
- int x;
- char option;
- char rematch;
- /*char letters[29] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'l', 'k', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'x', 'z', 'æ', 'ø', 'å', 'y', 'w' };*/
- bool replay;
- do{
- srand(time(NULL));
- z = (rand() % 365241 ^ 215);
- system("cls");
- cout << "Choose difficulity" << endl;
- cout << "(H) Hard 1-5000" << endl;
- cout << "(M) Medium 1-500" << endl;
- cout << "(E) Easy 1-50" << endl;
- cin >> option;
- /*for (int i = 1; i < 29; i++){
- if (letters[i] == x){
- cout << "You dumb trash-tier shitnigger, this was intended for fucking integers" << endl;*/
- /*}*/
- if ((option == 'H') || (option == 'h')) {
- srand(z);
- x = 1 + (rand() % 5000);
- }
- else if ((option == 'M') || (option == 'm')) {
- srand(z);
- x = 1 + (rand() % 500);
- }
- else if ((option == 'E') || (option == 'e')) {
- srand(z);
- x = 1 + (rand() % 50);
- }
- cout << x << endl;
- int number;
- cout << "Type in you number: ";
- cin >> number;
- // loop
- bool done = false;
- do
- {
- // Comparison operators: == != > < >= <=
- if (!(cin >> x))
- {
- cin.clear();
- cin.ignore(numeric_limits<streamsize>::max(), '\n');
- cout << endl << "Input must be an integer" << endl << endl;
- cout << "Type in you number: ";
- }
- else if (number <= x) {
- cout << "\nThat number is too low, try again" << endl;
- cout << "Type in your next guess: ";
- cin >> number;
- }
- else if (number >= x) {
- cout << "\nThat number is too high, try again" << endl;
- cout << "Type in your next guess: ";
- cin >> number;
- }
- if (number == x) {
- cout << "\nYou're right" << endl;
- cout << "Do you want to play again?" << endl;
- cout << " Press Y for yes or N for no" << endl;
- cin >> rematch;
- if ((rematch == 'Y') || (rematch == 'y')) {
- replay = true;
- done = false;
- break;
- }
- else if ((rematch == 'N') || (rematch == 'n')){
- exit(0);
- }
- }
- /*if (done == true) {
- }*/
- } while (done == false);
- } while ((rematch == 'Y') || (rematch == 'y')); {
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement