fix higherOrLower

This commit is contained in:
Sebastian Ranoszek 2025-02-10 13:16:05 +01:00
parent 9be01f4faa
commit bb0953bfe3

View File

@ -24,12 +24,17 @@ int balance = 0;
int bank_balance = 10000; int bank_balance = 10000;
int save_depo = 0; int save_depo = 0;
void display_balance(){
cout << "Your current casino balance: " << balance << " NyscoCoins" << endl;
}
void coinflip() { void coinflip() {
srand(time(0)); // Seed the random number generator srand(time(0)); // Seed the random number generator
int bet_amount; int bet_amount;
char user_choice; char user_choice;
display_balance();
cout << "Enter the amount of money you want to bet on the coin flip: "; cout << "Enter the amount of money you want to bet on the coin flip: ";
cin >> bet_amount; cin >> bet_amount;
@ -103,6 +108,7 @@ void slots() {
int bet_amount; int bet_amount;
char end_choice; char end_choice;
display_balance();
cout << "Enter the amount of money you want to bet on slots: "; cout << "Enter the amount of money you want to bet on slots: ";
cin >> bet_amount; cin >> bet_amount;
@ -163,6 +169,7 @@ void blackjack() {
cout << "Your cards: " << playerCard1 << " and " << playerCard2 << " (Total: " << playerTotal << ")" << endl; cout << "Your cards: " << playerCard1 << " and " << playerCard2 << " (Total: " << playerTotal << ")" << endl;
cout << "Dealer's visible card: " << dealerCard1 << endl; cout << "Dealer's visible card: " << dealerCard1 << endl;
display_balance();
cout << "Enter your bet amount: "; cout << "Enter your bet amount: ";
cin >> bet_amount; cin >> bet_amount;
@ -233,6 +240,7 @@ void diceRoll() {
int bet_amount, outcome; int bet_amount, outcome;
char end_choice; char end_choice;
display_balance();
cout << "Enter the amount of money you want to bet on dice roll: "; cout << "Enter the amount of money you want to bet on dice roll: ";
cin >> bet_amount; cin >> bet_amount;
@ -291,6 +299,7 @@ void higherOrLower() {
char outcome; char outcome;
char end_choice; char end_choice;
display_balance();
cout << "Enter the amount of money you want to bet on higer or lower: "; cout << "Enter the amount of money you want to bet on higer or lower: ";
cin >> bet_amount; cin >> bet_amount;
@ -306,12 +315,6 @@ void higherOrLower() {
higherOrLower(); higherOrLower();
} }
if (outcome > 100 || outcome < 1) {
cout << "The range is from 1 to 100" << endl;
Sleep(3000);
higherOrLower();
}
balance -= bet_amount; balance -= bet_amount;
cout << "Generating the output number.." << endl; cout << "Generating the output number.." << endl;