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/
.Makefile/
main.exe

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