modify for linux
This commit is contained in:
parent
933c9976e3
commit
f12ed00c5a
56
main.cpp
56
main.cpp
@ -53,15 +53,15 @@ void coinflip() {
|
|||||||
|
|
||||||
// Check if the user won or lost
|
// Check if the user won or lost
|
||||||
if ((user_choice == 'H' || user_choice == 'h') && flip_result == 0) {
|
if ((user_choice == 'H' || user_choice == 'h') && flip_result == 0) {
|
||||||
system("cls");
|
system("clear");
|
||||||
cout << "Congratulations! You won! You get double the bet amount." << endl;
|
cout << "Congratulations! You won! You get double the bet amount." << endl;
|
||||||
balance += 2 * bet_amount;
|
balance += 2 * bet_amount;
|
||||||
} else if ((user_choice == 'T' || user_choice == 't') && flip_result == 1) {
|
} else if ((user_choice == 'T' || user_choice == 't') && flip_result == 1) {
|
||||||
system("cls");
|
system("clear");
|
||||||
cout << "Congratulations! You won! You get double the bet amount." << endl;
|
cout << "Congratulations! You won! You get double the bet amount." << endl;
|
||||||
balance += 2 * bet_amount;
|
balance += 2 * bet_amount;
|
||||||
} else {
|
} else {
|
||||||
system("cls");
|
system("clear");
|
||||||
cout << "Sorry! You lost the bet. Better luck next time!" << endl;
|
cout << "Sorry! You lost the bet. Better luck next time!" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,10 +71,10 @@ void coinflip() {
|
|||||||
cin >> end_choice;
|
cin >> end_choice;
|
||||||
|
|
||||||
if (end_choice == 'y' || end_choice == 'Y') {
|
if (end_choice == 'y' || end_choice == 'Y') {
|
||||||
system("cls");
|
system("clear");
|
||||||
coinflip();
|
coinflip();
|
||||||
} else {
|
} else {
|
||||||
system("cls");
|
system("clear");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,10 +118,10 @@ void slots() {
|
|||||||
cin >> end_choice;
|
cin >> end_choice;
|
||||||
|
|
||||||
if (end_choice == 'y' || end_choice == 'Y') {
|
if (end_choice == 'y' || end_choice == 'Y') {
|
||||||
system("cls");
|
system("clear");
|
||||||
slots();
|
slots();
|
||||||
} else {
|
} else {
|
||||||
system("cls");
|
system("clear");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,10 +190,10 @@ void blackjack() {
|
|||||||
cin >> end_choice;
|
cin >> end_choice;
|
||||||
|
|
||||||
if (end_choice == 'y' || end_choice == 'Y') {
|
if (end_choice == 'y' || end_choice == 'Y') {
|
||||||
system("cls");
|
system("clear");
|
||||||
blackjack();
|
blackjack();
|
||||||
} else {
|
} else {
|
||||||
system("cls");
|
system("clear");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,7 +235,7 @@ void diceRoll() {
|
|||||||
|
|
||||||
cout << "You rolled: " << dice1 << " and " << dice2 << " (Total: " << total << ")" << endl;
|
cout << "You rolled: " << dice1 << " and " << dice2 << " (Total: " << total << ")" << endl;
|
||||||
|
|
||||||
if (total == 7) {
|
if (total == outcome) {
|
||||||
cout << "Congratulations! You won double your bet amount!" << endl;
|
cout << "Congratulations! You won double your bet amount!" << endl;
|
||||||
balance += 2 * bet_amount;
|
balance += 2 * bet_amount;
|
||||||
} else {
|
} else {
|
||||||
@ -248,10 +248,10 @@ void diceRoll() {
|
|||||||
cin >> end_choice;
|
cin >> end_choice;
|
||||||
|
|
||||||
if (end_choice == 'y' || end_choice == 'Y') {
|
if (end_choice == 'y' || end_choice == 'Y') {
|
||||||
system("cls");
|
system("clear");
|
||||||
diceRoll();
|
diceRoll();
|
||||||
} else {
|
} else {
|
||||||
system("cls");
|
system("clear");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,16 +267,16 @@ void deposit() {
|
|||||||
if (bank_balance >= deposit_amount) {
|
if (bank_balance >= deposit_amount) {
|
||||||
balance += deposit_amount;
|
balance += deposit_amount;
|
||||||
bank_balance -= deposit_amount;
|
bank_balance -= deposit_amount;
|
||||||
system("cls");
|
system("clear");
|
||||||
cout << "Deposit successful! Your new balance is: " << balance << " NyscoCoins"<< endl;
|
cout << "Deposit successful! Your new balance is: " << balance << " NyscoCoins"<< endl;
|
||||||
sleep(3);
|
sleep(3);
|
||||||
system("cls");
|
system("clear");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
system("cls");
|
system("clear");
|
||||||
cout << "You don't have enough money in your bank account!" << endl;
|
cout << "You don't have enough money in your bank account!" << endl;
|
||||||
sleep(3);
|
sleep(3);
|
||||||
system("cls");
|
system("clear");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,16 +287,16 @@ void withdraw() {
|
|||||||
if (balance >= withdraw_amount) {
|
if (balance >= withdraw_amount) {
|
||||||
balance -= withdraw_amount;
|
balance -= withdraw_amount;
|
||||||
bank_balance += withdraw_amount;
|
bank_balance += withdraw_amount;
|
||||||
system("cls");
|
system("clear");
|
||||||
cout << "Deposit successful! Your new balance is: " << balance << " NyscoCoins" << endl;
|
cout << "Deposit successful! Your new balance is: " << balance << " NyscoCoins" << endl;
|
||||||
sleep(3);
|
sleep(3);
|
||||||
system("cls");
|
system("clear");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
system("cls");
|
system("clear");
|
||||||
cout << "You don't have enough NyscoCoins to withdraw!" << endl;
|
cout << "You don't have enough NyscoCoins to withdraw!" << endl;
|
||||||
sleep(3);
|
sleep(3);
|
||||||
system("cls");
|
system("clear");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,35 +335,35 @@ int main() {
|
|||||||
|
|
||||||
switch (game_choice) {
|
switch (game_choice) {
|
||||||
case 'C': case 'c':
|
case 'C': case 'c':
|
||||||
system("cls");
|
system("clear");
|
||||||
coinflip();
|
coinflip();
|
||||||
break;
|
break;
|
||||||
case 'S': case 's':
|
case 'S': case 's':
|
||||||
system("cls");
|
system("clear");
|
||||||
slots();
|
slots();
|
||||||
break;
|
break;
|
||||||
case 'B': case 'b':
|
case 'B': case 'b':
|
||||||
system("cls");
|
system("clear");
|
||||||
blackjack();
|
blackjack();
|
||||||
break;
|
break;
|
||||||
case 'R': case 'r':
|
case 'R': case 'r':
|
||||||
system("cls");
|
system("clear");
|
||||||
roulette();
|
roulette();
|
||||||
break;
|
break;
|
||||||
case 'D': case 'd':
|
case 'D': case 'd':
|
||||||
system("cls");
|
system("clear");
|
||||||
diceRoll();
|
diceRoll();
|
||||||
break;
|
break;
|
||||||
case 'H': case 'h':
|
case 'H': case 'h':
|
||||||
system("cls");
|
system("clear");
|
||||||
higherOrLower();
|
higherOrLower();
|
||||||
break;
|
break;
|
||||||
case 'M': case 'm':
|
case 'M': case 'm':
|
||||||
system("cls");
|
system("clear");
|
||||||
deposit();
|
deposit();
|
||||||
break;
|
break;
|
||||||
case 'W': case 'w':
|
case 'W': case 'w':
|
||||||
system("cls");
|
system("clear");
|
||||||
withdraw();
|
withdraw();
|
||||||
break;
|
break;
|
||||||
case 'Q': case 'q':
|
case 'Q': case 'q':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user