switch <unistd.h> to <Windows.h> and change sleep func
This commit is contained in:
parent
cb7d0f7867
commit
7a0c3adc4b
38
main.cpp
38
main.cpp
@ -1,7 +1,7 @@
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
#include <unistd.h>
|
||||
#include <Windows.h>
|
||||
|
||||
using namespace std;
|
||||
char end_choice;
|
||||
@ -21,7 +21,7 @@ void coinflip() {
|
||||
// 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(3);
|
||||
Sleep(3000);
|
||||
}
|
||||
|
||||
// Deduct the bet amount from the balance
|
||||
@ -44,7 +44,7 @@ void coinflip() {
|
||||
cout << "The coin is flipping..." << endl;
|
||||
|
||||
// Wait a moment to simulate flipping
|
||||
sleep(3);
|
||||
Sleep(3000);
|
||||
|
||||
if (flip_result == 0) {
|
||||
cout << "The result is Heads!" << endl;
|
||||
@ -93,13 +93,13 @@ void slots() {
|
||||
|
||||
if (bet_amount > balance) {
|
||||
cout << "You don't have enough NyscoCoins! Please try again with a lower amount." << endl;
|
||||
sleep(3);
|
||||
Sleep(3000);
|
||||
}
|
||||
|
||||
balance -= bet_amount;
|
||||
|
||||
cout << "Spinning the slots..." << endl;
|
||||
sleep(2);
|
||||
Sleep(2000);
|
||||
|
||||
int slot1 = rand() % 5 + 1;
|
||||
int slot2 = rand() % 5 + 1;
|
||||
@ -153,7 +153,7 @@ void blackjack() {
|
||||
|
||||
if (bet_amount > balance) {
|
||||
cout << "You don't have enough NyscoCoins! Please try again with a lower amount." << endl;
|
||||
sleep(3);
|
||||
Sleep(3000);
|
||||
}
|
||||
|
||||
balance -= bet_amount;
|
||||
@ -226,20 +226,20 @@ void diceRoll() {
|
||||
|
||||
if (bet_amount > balance) {
|
||||
cout << "You don't have enough NyscoCoins! Please try again with a lower amount." << endl;
|
||||
sleep(3);
|
||||
Sleep(3000);
|
||||
diceRoll();
|
||||
}
|
||||
|
||||
if (outcome > 12) {
|
||||
cout << "There are only two dices max number is 12" << endl;
|
||||
sleep(3);
|
||||
Sleep(3000);
|
||||
diceRoll();
|
||||
}
|
||||
|
||||
balance -= bet_amount;
|
||||
|
||||
cout << "Rolling the dice..." << endl;
|
||||
sleep(2);
|
||||
Sleep(2000);
|
||||
|
||||
int dice1 = rand() % 6 + 1;
|
||||
int dice2 = rand() % 6 + 1;
|
||||
@ -287,20 +287,20 @@ void higherOrLower() {
|
||||
|
||||
if (bet_amount > balance) {
|
||||
cout << "You don't have enough NyscoCoins! Please try again with a lower amount." << endl;
|
||||
sleep(3);
|
||||
Sleep(3000);
|
||||
higherOrLower();
|
||||
}
|
||||
|
||||
if (outcome > 100 || outcome < 1) {
|
||||
cout << "The range is from 1 to 100" << endl;
|
||||
sleep(3);
|
||||
Sleep(3000);
|
||||
higherOrLower();
|
||||
}
|
||||
|
||||
balance -= bet_amount;
|
||||
|
||||
cout << "Generating the output number.." << endl;
|
||||
sleep(2);
|
||||
Sleep(2000);
|
||||
|
||||
int end_number = rand() % 100 + 1;
|
||||
|
||||
@ -354,13 +354,13 @@ void deposit() {
|
||||
bank_balance -= deposit_amount;
|
||||
system("clear");
|
||||
cout << "Deposit successful! Your new balance is: " << balance << " NyscoCoins"<< endl;
|
||||
sleep(3);
|
||||
Sleep(3000);
|
||||
system("clear");
|
||||
}
|
||||
else {
|
||||
system("clear");
|
||||
cout << "You don't have enough money in your bank account!" << endl;
|
||||
sleep(3);
|
||||
Sleep(3000);
|
||||
system("clear");
|
||||
}
|
||||
}
|
||||
@ -375,13 +375,13 @@ void withdraw() {
|
||||
bank_balance += withdraw_amount;
|
||||
system("clear");
|
||||
cout << "Deposit successful! Your new bank balance is: " << bank_balance << "$" << endl;
|
||||
sleep(3);
|
||||
Sleep(3000);
|
||||
system("clear");
|
||||
}
|
||||
else {
|
||||
system("clear");
|
||||
cout << "You don't have enough NyscoCoins to withdraw!" << endl;
|
||||
sleep(3);
|
||||
Sleep(3000);
|
||||
system("clear");
|
||||
}
|
||||
}
|
||||
@ -396,15 +396,15 @@ void work() {
|
||||
for (int i = 0; i < work_days; i++) {
|
||||
system("clear");
|
||||
cout << "\rWorking... " << i + 1 << " days" << endl;
|
||||
sleep(1);
|
||||
Sleep(1000);
|
||||
}
|
||||
system("clear");
|
||||
cout << "\nWork done!" << endl;
|
||||
sleep(3);
|
||||
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(3);
|
||||
Sleep(3000);
|
||||
system("clear");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user