complete code rewrite for windows

This commit is contained in:
Sebastian Ranoszek 2025-02-09 22:55:03 +01:00
parent 7a0c3adc4b
commit f1dc2afc36
4 changed files with 35 additions and 38 deletions

3
.gitignore vendored
View File

@ -1,2 +1 @@
.vscode/ main.exe
.Makefile/

View File

@ -1,2 +0,0 @@
all:
g++ -o main main.cpp

BIN
main

Binary file not shown.

View File

@ -55,17 +55,17 @@ 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("clear"); system("cls");
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("clear"); system("cls");
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("clear"); system("cls");
cout << "Sorry! You lost the bet. Better luck next time!" << endl; cout << "Sorry! You lost the bet. Better luck next time!" << endl;
} }
@ -75,11 +75,11 @@ void coinflip() {
cin >> end_choice; cin >> end_choice;
if (end_choice == 'y' || end_choice == 'Y') { if (end_choice == 'y' || end_choice == 'Y') {
system("clear"); system("cls");
coinflip(); coinflip();
} }
else { else {
system("clear"); system("cls");
} }
} }
@ -125,11 +125,11 @@ void slots() {
cin >> end_choice; cin >> end_choice;
if (end_choice == 'y' || end_choice == 'Y') { if (end_choice == 'y' || end_choice == 'Y') {
system("clear"); system("cls");
slots(); slots();
} }
else { else {
system("clear"); system("cls");
} }
} }
@ -201,11 +201,11 @@ void blackjack() {
cin >> end_choice; cin >> end_choice;
if (end_choice == 'y' || end_choice == 'Y') { if (end_choice == 'y' || end_choice == 'Y') {
system("clear"); system("cls");
blackjack(); blackjack();
} }
else { else {
system("clear"); system("cls");
} }
} }
@ -261,11 +261,11 @@ void diceRoll() {
cin >> end_choice; cin >> end_choice;
if (end_choice == 'y' || end_choice == 'Y') { if (end_choice == 'y' || end_choice == 'Y') {
system("clear"); system("cls");
diceRoll(); diceRoll();
} }
else { else {
system("clear"); system("cls");
} }
} }
@ -336,11 +336,11 @@ void higherOrLower() {
cin >> end_choice; cin >> end_choice;
if (end_choice == 'y' || end_choice == 'Y') { if (end_choice == 'y' || end_choice == 'Y') {
system("clear"); system("cls");
higherOrLower(); higherOrLower();
} }
else { else {
system("clear"); system("cls");
} }
} }
@ -352,16 +352,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("clear"); system("cls");
cout << "Deposit successful! Your new balance is: " << balance << " NyscoCoins"<< endl; cout << "Deposit successful! Your new balance is: " << balance << " NyscoCoins"<< endl;
Sleep(3000); Sleep(3000);
system("clear"); system("cls");
} }
else { else {
system("clear"); system("cls");
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(3000); Sleep(3000);
system("clear"); system("cls");
} }
} }
@ -373,16 +373,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("clear"); system("cls");
cout << "Deposit successful! Your new bank balance is: " << bank_balance << "$" << endl; cout << "Deposit successful! Your new bank balance is: " << bank_balance << "$" << endl;
Sleep(3000); Sleep(3000);
system("clear"); system("cls");
} }
else { else {
system("clear"); system("cls");
cout << "You don't have enough NyscoCoins to withdraw!" << endl; cout << "You don't have enough NyscoCoins to withdraw!" << endl;
Sleep(3000); Sleep(3000);
system("clear"); system("cls");
} }
} }
@ -394,22 +394,22 @@ void work() {
cout << "Working..." << endl; cout << "Working..." << endl;
for (int i = 0; i < work_days; i++) { for (int i = 0; i < work_days; i++) {
system("clear"); system("cls");
cout << "\rWorking... " << i + 1 << " days" << endl; cout << "\rWorking... " << i + 1 << " days" << endl;
Sleep(1000); Sleep(1000);
} }
system("clear"); system("cls");
cout << "\nWork done!" << endl; cout << "\nWork done!" << endl;
Sleep(3000); Sleep(3000);
int money_recieved = work_days * 120; int money_recieved = work_days * 120;
bank_balance += money_recieved * 0.88; bank_balance += money_recieved * 0.88;
cout << "\nYou recieved " << money_recieved * 0.88 << "$ (after tax) for working " << work_days << " days." << endl; cout << "\nYou recieved " << money_recieved * 0.88 << "$ (after tax) for working " << work_days << " days." << endl;
Sleep(3000); Sleep(3000);
system("clear"); system("cls");
} }
int main() { int main() {
system("clear"); system("cls");
char game_choice; char game_choice;
do { do {
@ -446,39 +446,39 @@ int main() {
switch (game_choice) { switch (game_choice) {
case 'C': case 'c': case 'C': case 'c':
system("clear"); system("cls");
coinflip(); coinflip();
break; break;
case 'S': case 's': case 'S': case 's':
system("clear"); system("cls");
slots(); slots();
break; break;
case 'B': case 'b': case 'B': case 'b':
system("clear"); system("cls");
blackjack(); blackjack();
break; break;
case 'R': case 'r': case 'R': case 'r':
system("clear"); system("cls");
roulette(); roulette();
break; break;
case 'D': case 'd': case 'D': case 'd':
system("clear"); system("cls");
diceRoll(); diceRoll();
break; break;
case 'H': case 'h': case 'H': case 'h':
system("clear"); system("cls");
higherOrLower(); higherOrLower();
break; break;
case 'M': case 'm': case 'M': case 'm':
system("clear"); system("cls");
deposit(); deposit();
break; break;
case 'W': case 'w': case 'W': case 'w':
system("clear"); system("cls");
withdraw(); withdraw();
break; break;
case 'J': case 'j': case 'J': case 'j':
system("clear"); system("cls");
work(); work();
break; break;
case 'Q': case 'q': case 'Q': case 'q':