#include #include #include #include using namespace std; char end_choice; int balance = 0; int bank_balance = 10000; int save_depo = 0; void coinflip() { srand(time(0)); // Seed the random number generator int bet_amount; char user_choice; cout << "Enter the amount of money you want to bet on the coin flip: "; cin >> bet_amount; // Check if the user has enough balance if (bet_amount > balance) { cout << "You don't have enough NyscoCoins! Please try again with a lower amount." << endl; Sleep(3000); } // Deduct the bet amount from the balance balance -= bet_amount; cout << "Choose your side: (H) for Heads or (T) for Tails: "; cin >> user_choice; // Validate user input if (user_choice != 'H' && user_choice != 'h' && user_choice != 'T' && user_choice != 't') { cout << "Invalid choice. Please enter either H for Heads or T for Tails." << endl; balance += bet_amount; // Return the bet amount if invalid input coinflip(); } // Generate a random result: 0 for Heads, 1 for Tails int flip_result = rand() % 2; // Show the result cout << "The coin is flipping..." << endl; // Wait a moment to simulate flipping Sleep(3000); if (flip_result == 0) { cout << "The result is Heads!" << endl; } else { cout << "The result is Tails!" << endl; } // Check if the user won or lost if ((user_choice == 'H' || user_choice == 'h') && flip_result == 0) { system("cls"); cout << "Congratulations! You won! You get double the bet amount." << endl; balance += 2 * bet_amount; } else if ((user_choice == 'T' || user_choice == 't') && flip_result == 1) { system("cls"); cout << "Congratulations! You won! You get double the bet amount." << endl; balance += 2 * bet_amount; } else { system("cls"); cout << "Sorry! You lost the bet. Better luck next time!" << endl; } cout << "Your new balance is: " << balance << " NyscoCoins" << endl; cout << "Play again? (Y/N): "; cin >> end_choice; if (end_choice == 'y' || end_choice == 'Y') { system("cls"); coinflip(); } else { system("cls"); } } void slots() { srand(time(0)); int bet_amount; char end_choice; cout << "Enter the amount of money you want to bet on slots: "; cin >> bet_amount; if (bet_amount > balance) { cout << "You don't have enough NyscoCoins! Please try again with a lower amount." << endl; Sleep(3000); } balance -= bet_amount; cout << "Spinning the slots..." << endl; Sleep(2000); int slot1 = rand() % 5 + 1; int slot2 = rand() % 5 + 1; int slot3 = rand() % 5 + 1; cout << "| " << slot1 << " | " << slot2 << " | " << slot3 << " |" << endl; if (slot1 == slot2 && slot2 == slot3) { cout << "JACKPOT! You won triple your bet amount!" << endl; balance += 3 * bet_amount; } else if (slot1 == slot2 || slot2 == slot3 || slot1 == slot3) { cout << "Nice! You won double your bet amount!" << endl; balance += 2 * bet_amount; } else { cout << "You lost! Better luck next time!" << endl; } cout << "Your new balance is: " << balance << " NyscoCoins" << endl; cout << "Play again? (Y/N): "; cin >> end_choice; if (end_choice == 'y' || end_choice == 'Y') { system("cls"); slots(); } else { system("cls"); } } void blackjack() { srand(time(0)); int playerCard1 = rand() % 11 + 1; int playerCard2 = rand() % 11 + 1; int dealerCard1 = rand() % 11 + 1; int dealerCard2 = rand() % 11 + 1; int playerTotal = playerCard1 + playerCard2; int dealerTotal = dealerCard1 + dealerCard2; int bet_amount; char end_choice; cout << "Your cards: " << playerCard1 << " and " << playerCard2 << " (Total: " << playerTotal << ")" << endl; cout << "Dealer's visible card: " << dealerCard1 << endl; cout << "Enter your bet amount: "; cin >> bet_amount; if (bet_amount > balance) { cout << "You don't have enough NyscoCoins! Please try again with a lower amount." << endl; Sleep(3000); } balance -= bet_amount; char choice; do { cout << "Do you want to hit (H) or stand (S)? "; cin >> choice; if (choice == 'H' || choice == 'h') { int newCard = rand() % 11 + 1; playerTotal += newCard; cout << "You drew a " << newCard << ". Your total is now " << playerTotal << "." << endl; if (playerTotal > 21) { cout << "You bust! Dealer wins." << endl; } } } while (choice == 'H' || choice == 'h'); cout << "Dealer's turn. Dealer's total is " << dealerTotal << "." << endl; while (dealerTotal < 17) { int newCard = rand() % 11 + 1; dealerTotal += newCard; cout << "Dealer drew a " << newCard << ". Dealer's total is now " << dealerTotal << "." << endl; } if (dealerTotal > 21 || playerTotal > dealerTotal) { cout << "You win! You gain " << bet_amount << " NyscoCoins." << endl; balance += 2 * bet_amount; // Win pays 2:1 } else if (playerTotal < dealerTotal) { cout << "Dealer wins! You lose your bet." << endl; } else { cout << "It's a tie! Your bet is returned." << endl; balance += bet_amount; // Return bet } cout << "Your new balance is: " << balance << " NyscoCoins" << endl; cout << "Play again? (Y/N): "; cin >> end_choice; if (end_choice == 'y' || end_choice == 'Y') { system("cls"); blackjack(); } else { system("cls"); } } void roulette() { cout << "Roulette game logic coming soon!" << endl; } void diceRoll() { srand(time(0)); int bet_amount, outcome; char end_choice; cout << "Enter the amount of money you want to bet on dice roll: "; cin >> bet_amount; cout << "Guess the outcome: "; cin >> outcome; if (bet_amount > balance) { cout << "You don't have enough NyscoCoins! Please try again with a lower amount." << endl; Sleep(3000); diceRoll(); } if (outcome > 12) { cout << "There are only two dices max number is 12" << endl; Sleep(3000); diceRoll(); } balance -= bet_amount; cout << "Rolling the dice..." << endl; Sleep(2000); int dice1 = rand() % 6 + 1; int dice2 = rand() % 6 + 1; int total = dice1 + dice2; cout << "You rolled: " << dice1 << " and " << dice2 << " (Total: " << total << ")" << endl; if (total == outcome) { cout << "Congratulations! You won double your bet amount!" << endl; balance += 2 * bet_amount; } else { cout << "You lost! Better luck next time!" << endl; } cout << "Your new balance is: " << balance << " NyscoCoins" << endl; cout << "Play again? (Y/N): "; cin >> end_choice; if (end_choice == 'y' || end_choice == 'Y') { system("cls"); diceRoll(); } else { system("cls"); } } void higherOrLower() { srand(time(0)); int bet_amount; char outcome; char end_choice; cout << "Enter the amount of money you want to bet on higer or lower: "; cin >> bet_amount; int start_number = rand() % 100 + 1; cout << "Starting number: " << start_number << endl; cout << "Guess the outcome (H-Higher/L-Lower): "; cin >> outcome; if (bet_amount > balance) { cout << "You don't have enough NyscoCoins! Please try again with a lower amount." << endl; Sleep(3000); higherOrLower(); } if (outcome > 100 || outcome < 1) { cout << "The range is from 1 to 100" << endl; Sleep(3000); higherOrLower(); } balance -= bet_amount; cout << "Generating the output number.." << endl; Sleep(2000); int end_number = rand() % 100 + 1; if(start_number > end_number) { cout << "You guessed: " << outcome << " (The outcome is: " << end_number << " and its lower!)" << endl; } else if(start_number < end_number) { cout << "You guessed: " << outcome << " (The outcome is: " << end_number << " and its higher!)" << endl; } if (outcome == 'H' || outcome == 'h') { if (start_number < end_number) { cout << "Congratulations! You won double your bet amount!" << endl; balance += 2 * bet_amount; } else { cout << "You lost! Better luck next time!" << endl; } } else if (outcome == 'L' || outcome == 'l') { if (start_number > end_number) { cout << "Congratulations! You won double your bet amount!" << endl; balance += 2 * bet_amount; } else { cout << "You lost! Better luck next time!" << endl; } } cout << "Your new balance is: " << balance << " NyscoCoins" << endl; cout << "Play again? (Y/N): "; cin >> end_choice; if (end_choice == 'y' || end_choice == 'Y') { system("cls"); higherOrLower(); } else { system("cls"); } } void deposit() { int deposit_amount; cout << "Current money in bank: " << bank_balance; cout << "Enter the amount of money you want to deposit: "; cin >> deposit_amount; if (bank_balance >= deposit_amount) { balance += deposit_amount; bank_balance -= deposit_amount; system("cls"); cout << "Deposit successful! Your new balance is: " << balance << " NyscoCoins"<< endl; Sleep(3000); system("cls"); } else { system("cls"); cout << "You don't have enough money in your bank account!" << endl; Sleep(3000); system("cls"); } } void withdraw() { int withdraw_amount; cout << "Current NyscoCoin balance: " << balance; cout << "Enter the amount of money you want to withdraw: "; cin >> withdraw_amount; if (balance >= withdraw_amount) { balance -= withdraw_amount; bank_balance += withdraw_amount; system("cls"); cout << "Deposit successful! Your new bank balance is: " << bank_balance << "$" << endl; Sleep(3000); system("cls"); } else { system("cls"); cout << "You don't have enough NyscoCoins to withdraw!" << endl; Sleep(3000); system("cls"); } } void work() { int work_days; cout << "How many days do you want to work (days = seconds): "; cin >> work_days; cout << "Working..." << endl; for (int i = 0; i < work_days; i++) { system("cls"); cout << "\rWorking... " << i + 1 << " days" << endl; Sleep(1000); } system("cls"); cout << "\nWork done!" << endl; Sleep(3000); int money_recieved = work_days * 120; bank_balance += money_recieved * 0.88; cout << "\nYou recieved " << money_recieved * 0.88 << "$ (after tax) for working " << work_days << " days." << endl; Sleep(3000); system("cls"); } int main() { system("cls"); char game_choice; do { cout << R"( _ __ ______ _ / | / /_ ________________ / ____/___ ______(_)___ ____ / |/ / / / / ___/ ___/ __ \ / / / __ `/ ___/ / __ \/ __ \ / /| / /_/ (__ ) /__/ /_/ / / /___/ /_/ (__ ) / / / / /_/ / /_/ |_/\__, /____/\___/\____/ \____/\__,_/____/_/_/ /_/\____/ /____/ -------------------------------------------------------------------------- )" << endl; cout << "Your current bank balance: " << bank_balance << "$" << endl; cout << "Your current casino balance: " << balance << " NyscoCoins" << endl; cout << "--------------------" << endl; cout << "CHOOSE THE GAME: " << endl; cout << "--------------------" << endl; cout << "(C) - Coinflip" << endl; cout << "(S) - Slots" << endl; cout << "(B) - Blackjack" << endl; cout << "(R) - Roulette (Coming soon!)" << endl; cout << "(D) - Dice Roll" << endl; cout << "(H) - Higher or Lower" << endl; cout << "--------------------" << endl; cout << "(J) - Go To Work" << endl; cout << "--------------------" << endl; cout << "(M) - Deposit Money" << endl; cout << "(W) - Withdraw NyscoCoins" << endl; cout << "--------------------" << endl; cout << "(Q) - Quit" << endl; cout << "Enter your choice: "; cin >> game_choice; switch (game_choice) { case 'C': case 'c': system("cls"); coinflip(); break; case 'S': case 's': system("cls"); slots(); break; case 'B': case 'b': system("cls"); blackjack(); break; case 'R': case 'r': system("cls"); roulette(); break; case 'D': case 'd': system("cls"); diceRoll(); break; case 'H': case 'h': system("cls"); higherOrLower(); break; case 'M': case 'm': system("cls"); deposit(); break; case 'W': case 'w': system("cls"); withdraw(); break; case 'J': case 'j': system("cls"); work(); break; case 'Q': case 'q': cout << "Thanks for playing!" << endl; break; default: cout << "Invalid choice. Please try again." << endl; break; } } while (game_choice != 'Q' && game_choice != 'q'); system("pause"); return 0; }