Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
4000CEMGameGithub/ConsoleApplication2.cpp
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
110 lines (94 sloc)
1.77 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include"Header.h" | |
bool dontexit(int x) | |
{ | |
if (x == 1) | |
{ | |
return true; | |
} | |
else | |
{ | |
return false; | |
} | |
} | |
bool finance(int x) | |
{ | |
bool gos = true; | |
if (x < 0) | |
{ | |
cout << "Your City is Bankrupt ! Better Luck Next Time" << endl; | |
bool played1 = PlaySound(TEXT("GameOver.wav"), NULL, SND_SYNC); | |
gos = false; | |
return gos; | |
} | |
else | |
{ | |
return gos; | |
} | |
} | |
void finance1() | |
{ | |
if (hours % 30 == 0) | |
{ | |
sum = sum + 800000; | |
} | |
} | |
void timer() | |
{ | |
while (true) { | |
finance1(); | |
if (finance(sum) == true) | |
{ | |
Sleep(1000); | |
seconds = seconds + 60; | |
if (seconds == 60) { | |
minutes = minutes + 60; | |
if (minutes == 60) { | |
hours++; | |
minutes = 0; | |
} | |
seconds = 0; | |
} | |
} | |
} | |
} | |
void player() | |
{ | |
while (true) | |
{ | |
bool played = PlaySound(TEXT("gamemusic.wav"), NULL, SND_SYNC); | |
} | |
} | |
void GameEngine() | |
{ | |
thread t1(GameCommandEngine); | |
thread t2(player); | |
thread t3(timer); | |
thread t4(GameCommandEngine); | |
thread t5(player); | |
thread t6(timer); | |
thread t7(GameCommandEngine); | |
thread t8(player); | |
thread t9(timer); | |
thread t10(GameCommandEngine); | |
thread t11(player); | |
thread t13(timer); | |
t1.join(); | |
t2.join(); | |
t3.join(); | |
t4.join(); | |
t5.join(); | |
t6.join(); | |
t7.join(); | |
t8.join(); | |
t9.join(); | |
t10.join(); | |
t11.join(); | |
t13.join(); | |
} | |
int main() | |
{ | |
cout << welcometext(5) << endl; | |
Tutorials(3); | |
GameEngine(); | |
return 0; | |
} |