Last active
April 20, 2021 09:54
-
-
Save momade009/fb1a24e2cca8a06ee9b2d5c0c16c1493 to your computer and use it in GitHub Desktop.
COVID 19 game : I just start learning c++ about 1 mouth and learning coding is really complicate. Please advice me about what should i do or learn next, And some comment about this game or how i code too thank!
This file contains hidden or 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 <iostream> | |
| #include <stdlib.h> | |
| #include <unistd.h> | |
| #include <time.h> | |
| using namespace std; //corona attack game data :station,people,chace_infect, input:travel,time stay player | |
| void chace_meet(); | |
| void shop(); | |
| struct Mall{ | |
| int mall_number_people; | |
| int mall_infect_people; | |
| int time; | |
| bool ran1; | |
| }; | |
| void convert(int convert,int &min,int &hour){ | |
| min=convert%60; | |
| hour=convert/60; | |
| } | |
| void shop(float &gold,int &mask,int &vacine,int &alcohol){ | |
| bool quit; | |
| while(quit!=1){ | |
| string input_shop; | |
| cout<<" GOLD :"<<gold<<endl; | |
| cout<<"1.MASK(Reduce 25% Covid Chace/1round) 10 gold"<<endl; | |
| cout<<"2.ALCOHOL GEL(Reduce 50% Covid Chace/2round) 20 gold"<<endl; | |
| cout<<"3.VACINE(Protect from covid 1 time) 40 gold"<<endl; | |
| cout<<"4.EXIT"<<endl; | |
| cin>>input_shop; | |
| if(input_shop==({"1";})||input_shop==({"MASK";})){ | |
| if(gold>=10){ | |
| mask+=1; | |
| gold-=10; | |
| } | |
| else{ | |
| cout<<"Not enough gold"<<endl; | |
| } | |
| } | |
| if(input_shop==({"2";})||input_shop==({"ALCOHOL";})){ | |
| if(gold>=20){ | |
| alcohol+=2; | |
| gold-=20; | |
| } | |
| else{ | |
| cout<<"Not enough gold"<<endl; | |
| } | |
| } | |
| if(input_shop==({"3";})||input_shop==({"VACINE";})){ | |
| if(gold>=40){ | |
| vacine+=1; | |
| gold-=40; | |
| } | |
| else{ | |
| cout<<"Not enough gold"<<endl; | |
| } | |
| } | |
| if(input_shop==({"4";})||input_shop==({"EXIT";})){ | |
| quit=1; | |
| } | |
| } | |
| } | |
| void chace_meet(Mall mall_1,Mall pub_1,Mall casino_1,bool &infected,int &all_infected, | |
| int &all_people,int &time_mall,int &time_pub,int &time_casino,int &mall_infect,int &pub_infect,int &casino_infect,float &gold,int &mask,int &vacine,int &alcohol){ | |
| int row=0; | |
| int random; //chace_meet(mall_1,pub_1,casino_1,infected,all_infected,all_people,time_mall,time_pub,time_casino,mall_infect,pub_infect,casino_infect,gold,mask,vacine,alcohol); | |
| int m_infected=0; | |
| int hour; | |
| int min; | |
| float realgold; | |
| if(mall_1.ran1==1){ | |
| convert(mall_1.time,min,hour); | |
| if(vacine>0){ | |
| cout<<"VACINE X"<<vacine<<endl; | |
| } | |
| if(mask>0&&alcohol<=0){ | |
| cout<<"MASK X"<<mask<<endl; | |
| cout<<"Mall "<<mall_1.mall_number_people<<" people "<<mall_1.mall_infect_people<<" infected time :"<<hour<<" hour"<<" :"<<min<<" minuted"<<" CHACE INFECT :8.3333%"<<endl<<endl; | |
| } | |
| if(alcohol>0&&mask<=0){ | |
| cout<<"ALCOHOL X"<<alcohol<<endl; | |
| cout<<"Mall "<<mall_1.mall_number_people<<" people "<<mall_1.mall_infect_people<<" infected time :"<<hour<<" hour"<<" :"<<min<<" minuted"<<" CHACE INFECT :6.6667%"<<endl<<endl; | |
| } | |
| if(mask>0&&alcohol>0){ | |
| cout<<"MASK X"<<mask<<" ALCOHOL X"<<alcohol<<endl; | |
| cout<<"Mall "<<mall_1.mall_number_people<<" people "<<mall_1.mall_infect_people<<" infected time :"<<hour<<" hour"<<" :"<<min<<" minuted"<<" CHACE INFECT :6.25%"<<endl<<endl; | |
| } | |
| if(mask<=0&&alcohol<=0){ | |
| cout<<"Mall "<<mall_1.mall_number_people<<" people "<<mall_1.mall_infect_people<<" infected time :"<<hour<<" hour"<<" :"<<min<<" minuted"<<" CHACE INFECT :10%"<<endl<<endl; | |
| } | |
| sleep(2); | |
| for(int a=0;a<mall_1.time;a++){ | |
| row++; | |
| time_mall++; | |
| all_people++; | |
| random=1+(rand()%mall_1.mall_number_people); | |
| if(random<=mall_1.mall_infect_people){ | |
| all_infected++; | |
| mall_infect++; | |
| if(mask==0){ | |
| if(alcohol==0){ | |
| int in_random; | |
| in_random=1+(rand()%10); | |
| if(in_random==1||in_random==2||in_random==3||in_random==4||in_random==5||in_random==6||in_random==7||in_random==8||in_random==9){ | |
| m_infected++; | |
| cout<<"Person u have meet :"<<row<<endl; | |
| cout<<"U meet infected people!"<<endl; | |
| sleep(1.5); | |
| } | |
| if(in_random==10){ | |
| if(vacine==0){ | |
| cout<<"Number of people you meet :"<<row<<endl; | |
| cout<<"U r infected!!!"<<endl<<endl; | |
| infected=1; | |
| sleep(1.5); | |
| break; | |
| } | |
| if(vacine==1){ | |
| cout<<"Number of people you meet :"<<row<<endl; | |
| cout<<"U r infected! But VACINE CURE VIRUS!!"<<endl<<endl; | |
| vacine-=1; | |
| sleep(2); | |
| } | |
| } | |
| }//alcohol==0; | |
| else{ | |
| int in_random; | |
| in_random=1+(rand()%15); | |
| if(in_random==1||in_random==2||in_random==3||in_random==4||in_random==5 | |
| ||in_random==6||in_random==7||in_random==8||in_random==9||in_random==10||in_random==11||in_random==12||in_random==13 | |
| ||in_random==14){ | |
| m_infected++; | |
| cout<<"Person u have meet :"<<row<<endl; | |
| cout<<"U meet infected people!"<<endl; | |
| sleep(1.5); | |
| } | |
| if(in_random==15){ | |
| if(vacine==0){ | |
| cout<<"Number of people you meet :"<<row<<endl; | |
| cout<<"U r infected!!!"<<endl<<endl; | |
| infected=1; | |
| sleep(1.5); | |
| break; | |
| } | |
| if(vacine==1){ | |
| cout<<"Number of people you meet :"<<row<<endl; | |
| cout<<"U r infected! But VACINE CURE VIRUS!!"<<endl<<endl; | |
| vacine-=1; | |
| sleep(2); | |
| } | |
| } | |
| }//alcohol==1; | |
| }//mask==0 | |
| else{ | |
| if(alcohol==0){ | |
| int in_random; | |
| in_random=1+(rand()%12); | |
| if(in_random==1||in_random==2||in_random==3||in_random==4||in_random==5 | |
| ||in_random==6||in_random==7||in_random==8||in_random==9||in_random==10||in_random==11){ | |
| m_infected++; | |
| cout<<"Person u have meet :"<<row<<endl; | |
| cout<<"U meet infected people!"<<endl; | |
| sleep(1.5); | |
| } | |
| if(in_random==12){ | |
| if(vacine==0){ | |
| cout<<"Number of people you meet :"<<row<<endl; | |
| cout<<"U r infected!!!"<<endl<<endl; | |
| infected=1; | |
| sleep(1.5); | |
| break; | |
| } | |
| if(vacine==1){ | |
| cout<<"Number of people you meet :"<<row<<endl; | |
| cout<<"U r infected! But VACINE CURE VIRUS!!"<<endl<<endl; | |
| vacine-=1; | |
| sleep(2); | |
| } | |
| } | |
| }//alcohol==0 | |
| else{ | |
| int in_random; | |
| in_random=1+(rand()%16); | |
| if(in_random==1||in_random==2||in_random==3||in_random==4||in_random==5 | |
| ||in_random==6||in_random==7||in_random==8||in_random==9||in_random==10||in_random==11||in_random==12||in_random==13 | |
| ||in_random==14||in_random==15){ | |
| m_infected++; | |
| pub_infect++; | |
| cout<<"Person u have meet :"<<row<<endl; | |
| cout<<"U meet infected people!"<<endl; | |
| sleep(1.5); | |
| } | |
| if(in_random==16){ | |
| if(vacine==0){ | |
| cout<<"Number of people you meet :"<<row<<endl; | |
| cout<<"U r infected!!!"<<endl<<endl; | |
| infected=1; | |
| sleep(1.5); | |
| break; | |
| } | |
| if(vacine==1){ | |
| cout<<"Number of people you meet :"<<row<<endl; | |
| cout<<"U r infected! But VACINE CURE VIRUS!!"<<endl<<endl; | |
| vacine-=1; | |
| sleep(2); | |
| } | |
| } | |
| }//alcohol==1; | |
| }//mask==1 | |
| }//if meet infect; | |
| }//for | |
| system("CLS"); | |
| cout<<"MALL:LOADING ."<<endl; | |
| sleep(1); | |
| system("CLS"); | |
| cout<<"MALL:LOADING . ."<<endl; | |
| sleep(1); | |
| system("CLS"); | |
| cout<<"MALL:LOADING . . ."<<endl; | |
| sleep(1); | |
| system("CLS"); | |
| cout<<"MALL:LOADING . . . ."<<endl; | |
| sleep(1); | |
| system("CLS"); | |
| if(infected==0){ | |
| cout<<""<<m_infected<<" infected people u have meet at mall"<<endl; | |
| cout<<"u have surive from mall"<<endl<<endl; | |
| sleep(1.5); | |
| } | |
| }//mall_1; | |
| if(pub_1.ran1==1){ | |
| convert(pub_1.time,min,hour); | |
| if(vacine>0){ | |
| cout<<"VACINE X"<<vacine<<endl; | |
| } | |
| if(mask>0&&alcohol<=0){ | |
| cout<<"MASK X"<<mask<<endl; | |
| cout<<"PUB "<<pub_1.mall_number_people<<" people "<<pub_1.mall_infect_people<<" infected time :"<<hour<<" hour"<<" :"<<min<<" minuted"<<" CHACE INFECT :20%"<<endl<<endl; | |
| } | |
| if(alcohol>0&&mask<=0){ | |
| cout<<"ALCOHOL X"<<alcohol<<endl; | |
| cout<<"PUB "<<pub_1.mall_number_people<<" people "<<pub_1.mall_infect_people<<" infected time :"<<hour<<" hour"<<" :"<<min<<" minuted"<<" CHACE INFECT :16.666%"<<endl<<endl; | |
| } | |
| if(mask>0&&alcohol>0){ | |
| cout<<"MASK X"<<mask<<" ALCOHOL X"<<alcohol<<endl; | |
| cout<<"PUB "<<pub_1.mall_number_people<<" people "<<pub_1.mall_infect_people<<" infected time :"<<hour<<" hour"<<" :"<<min<<" minuted"<<" CHACE INFECT :14.285%"<<endl<<endl; | |
| } | |
| if(mask<=0&&alcohol<=0){ | |
| cout<<"Mall "<<pub_1.mall_number_people<<" people "<<pub_1.mall_infect_people<<" infected time :"<<hour<<" hour"<<" :"<<min<<" minuted"<<" CHACE INFECT :25%"<<endl<<endl; | |
| } | |
| sleep(2); | |
| for(int a=0;a<pub_1.time;a++){ | |
| row++; | |
| all_people++; | |
| time_pub++; | |
| random=1+(rand()%pub_1.mall_number_people); | |
| if(random<=pub_1.mall_infect_people){ | |
| all_infected++; | |
| pub_infect++; | |
| cout<<"Person u have meet :"<<row<<endl; | |
| cout<<"U meet infected people!"<<endl; | |
| sleep(1.5); | |
| if(mask==0){ | |
| if(alcohol==0){ | |
| int in_random; | |
| in_random=1+(rand()%4); | |
| if(in_random==1||in_random==2||in_random==3){ | |
| m_infected++; | |
| cout<<"U just meet infected people but u r fine"<<endl<<endl; | |
| sleep(1.5); | |
| } | |
| if(in_random==4){ | |
| if(vacine==0){ | |
| if(in_random==4){ | |
| cout<<"U r infected!!!"<<endl<<endl; | |
| infected=1; | |
| break; | |
| } | |
| } | |
| if(vacine==1){ | |
| vacine-=1; | |
| cout<<"U infected! But VACINE save you life"<<endl<<endl; | |
| sleep(1.5); | |
| } | |
| } | |
| }//alcohol=0; | |
| else{ | |
| int in_random; | |
| in_random=1+(rand()%6); | |
| if(in_random==1||in_random==2||in_random==3||in_random==4||in_random==5){ | |
| m_infected++; | |
| } | |
| if(in_random==6){ | |
| if(vacine==0){ | |
| if(in_random==4){ | |
| cout<<"U r infected!!!"<<endl<<endl; | |
| infected=1; | |
| break; | |
| } | |
| } | |
| if(vacine==1){ | |
| vacine-=1; | |
| cout<<"U infected! But VACINE save you life"<<endl<<endl; | |
| sleep(1.5); | |
| } | |
| } | |
| }//alcohol=1; | |
| }//mask=0; | |
| else{ | |
| if(alcohol==0){ | |
| int in_random; | |
| in_random=1+(rand()%5); | |
| if(in_random==1||in_random==2||in_random==3||in_random==4){ | |
| m_infected++; | |
| } | |
| if(in_random==5){ | |
| if(vacine==0){ | |
| cout<<"U r infected!!!"<<endl<<endl; | |
| infected=1; | |
| break; | |
| } | |
| if(vacine==1){ | |
| vacine-=1; | |
| cout<<"U infected! But VACINE save you life"<<endl<<endl; | |
| sleep(1.5); | |
| } | |
| } | |
| }//alcohol==0; | |
| else{ | |
| int in_random; | |
| in_random=1+(rand()%7); | |
| if(in_random==1||in_random==2||in_random==3||in_random==4||in_random==5||in_random==6){ | |
| m_infected++; | |
| } | |
| if(in_random==7){ | |
| if(vacine==0){ | |
| cout<<"U r infected!!!"<<endl<<endl; | |
| infected=1; | |
| break; | |
| } | |
| if(vacine==1){ | |
| vacine-=1; | |
| cout<<"U infected! But VACINE save you life"<<endl<<endl; | |
| sleep(1.5); | |
| } | |
| } | |
| }//alcohol==1; | |
| }//mask==1; | |
| }//if infect; | |
| }//for | |
| system("CLS"); | |
| cout<<"PUB:LOADING ."<<endl; | |
| sleep(1); | |
| system("CLS"); | |
| cout<<"PUB:LOADING . ."<<endl; | |
| sleep(1); | |
| system("CLS"); | |
| cout<<"PUB:LOADING . . ."<<endl; | |
| sleep(1); | |
| system("CLS"); | |
| cout<<"PUB:LOADING . . . ."<<endl; | |
| sleep(1); | |
| system("CLS"); | |
| if(infected==0){ | |
| cout<<""<<m_infected<<" infected people u have meet al pub"<<endl; | |
| cout<<"u have surive from pub"<<endl<<endl; | |
| } | |
| }//pub_ran1 | |
| if(casino_1.ran1==1){ | |
| convert(casino_1.time,min,hour); | |
| if(vacine>0){ | |
| cout<<"VACINE X"<<vacine<<endl; | |
| } | |
| if(mask>0&&alcohol<=0){ | |
| cout<<"MASK X"<<mask<<endl; | |
| cout<<"CASINO "<<casino_1.mall_number_people<<" people "<<casino_1.mall_infect_people<<" infected time :"<<hour<<" hour"<<" :"<<min<<" minuted"<<" CHACE INFECT :16.666%"<<endl<<endl; | |
| } | |
| if(alcohol>0&&mask<=0){ | |
| cout<<"ALCOHOL X"<<alcohol<<endl; | |
| cout<<"CASINO "<<casino_1.mall_number_people<<" people "<<casino_1.mall_infect_people<<" infected time :"<<hour<<" hour"<<" :"<<min<<" minuted"<<" CHACE INFECT :14.285%"<<endl<<endl; | |
| } | |
| if(mask>0&&alcohol>0){ | |
| cout<<"MASK X"<<mask<<" ALCOHOL X"<<alcohol<<endl; | |
| cout<<"CASINO "<<casino_1.mall_number_people<<" people "<<casino_1.mall_infect_people<<" infected time :"<<hour<<" hour"<<" :"<<min<<" minuted"<<" CHACE INFECT :11.111%"<<endl<<endl; | |
| } | |
| if(mask<=0&&alcohol<=0){ | |
| cout<<"CASINO "<<casino_1.mall_number_people<<" people "<<casino_1.mall_infect_people<<" infected time :"<<hour<<" hour"<<" :"<<min<<" minuted"<<" CHACE INFECT :20%"<<endl<<endl; | |
| } | |
| sleep(2); | |
| for(int a=0;a<casino_1.time;a++){ | |
| row++; | |
| time_casino++; | |
| all_people++; | |
| random=1+(rand()%casino_1.mall_number_people); | |
| if(random<=casino_1.mall_infect_people){ | |
| all_infected++; | |
| casino_infect++; | |
| cout<<"Person u have meet :"<<row<<endl; | |
| cout<<"U meet infected people!"<<endl; | |
| sleep(1.5); | |
| if(mask==0){ | |
| if(alcohol==0){ | |
| int in_random; | |
| in_random=1+(rand()%5); | |
| if(in_random==1||in_random==2||in_random==3||in_random==4){ | |
| m_infected++; | |
| cout<<"U just meet infected people but u r fine"<<endl<<endl; | |
| sleep(1.5); | |
| } | |
| if(in_random==5){ | |
| if(vacine==0){ | |
| cout<<"U r infected!!!"<<endl<<endl; | |
| infected=1; | |
| sleep(1.5); | |
| break; | |
| } | |
| if(vacine==1){ | |
| vacine-=1; | |
| cout<<"U infected! But VACINE save you life"<<endl<<endl; | |
| sleep(1.5); | |
| } | |
| } | |
| }//alcohol=0; | |
| if(alcohol==1){ | |
| int in_random; | |
| in_random=1+(rand()%7); | |
| if(in_random==1||in_random==2||in_random==3||in_random==4||in_random==5||in_random==6){ | |
| m_infected++; | |
| cout<<"U just meet infected people but u r fine"<<endl<<endl; | |
| sleep(1.5); | |
| } | |
| if(in_random==7){ | |
| if(vacine==0){ | |
| cout<<"U r infected!!!"<<endl<<endl; | |
| infected=1; | |
| sleep(1.5); | |
| break; | |
| } | |
| if(vacine==1){ | |
| vacine-=1; | |
| cout<<"U infected! But VACINE save you life"<<endl<<endl; | |
| sleep(1.5); | |
| } | |
| } | |
| }//alcohol=1; | |
| }//mask=0; | |
| else{ | |
| if(alcohol==0){ | |
| int in_random; | |
| in_random=1+(rand()%6); | |
| if(in_random==1||in_random==2||in_random==3||in_random==4||in_random==5){ | |
| m_infected++; | |
| cout<<"U just meet infected people but u r fine"<<endl<<endl; | |
| sleep(1.5); | |
| } | |
| if(in_random==6){ | |
| if(vacine==0){ | |
| cout<<"U r infected!!!"<<endl<<endl; | |
| infected=1; | |
| sleep(1.5); | |
| break; | |
| } | |
| if(vacine==1){ | |
| vacine-=1; | |
| cout<<"U infected! But VACINE cure virus!"<<endl<<endl; | |
| sleep(1.5); | |
| } | |
| } | |
| }//alcohol=0; | |
| else{ | |
| int in_random; | |
| in_random=1+(rand()%9); | |
| if(in_random==1||in_random==2||in_random==3||in_random==4||in_random==5||in_random==6||in_random==7||in_random==8){ | |
| m_infected++; | |
| cout<<"U just meet infected people but u r fine"<<endl<<endl; | |
| sleep(1.5); | |
| } | |
| if(in_random==9){ | |
| if(vacine==0){ | |
| cout<<"U r infected!!!"<<endl<<endl; | |
| infected=1; | |
| sleep(1.5); | |
| break; | |
| } | |
| if(vacine==1){ | |
| vacine-=1; | |
| cout<<"U infected! But VACINE cure virus!"<<endl<<endl; | |
| sleep(1.5); | |
| } | |
| } | |
| }//alcohol=1; | |
| }//mask==1; | |
| }//if infect; | |
| }//for | |
| system("CLS"); | |
| cout<<"CASINO:LOADING ."<<endl; | |
| sleep(1); | |
| system("CLS"); | |
| cout<<"CASINO:LOADING . ."<<endl; | |
| sleep(1); | |
| system("CLS"); | |
| cout<<"CASINO:LOADING . . ."<<endl; | |
| sleep(1); | |
| system("CLS"); | |
| cout<<"CASINO:LOADING . . . ."<<endl; | |
| sleep(1); | |
| system("CLS"); | |
| if(infected==0){ | |
| cout<<""<<m_infected<<" infected people u have meet al casino"<<endl; | |
| cout<<"u have surive from casino"<<endl<<endl; | |
| } | |
| }//casino_ran1 | |
| if(alcohol>0){ | |
| alcohol-=1; | |
| } | |
| if(mask>0){ | |
| mask-=1; | |
| } | |
| realgold=row*0.1; | |
| gold+=realgold; | |
| } | |
| int main(){ | |
| int c_time,min,hour,check_mall; | |
| int place_mall=0,place_pub=0,place_casino=0; | |
| int all_infected=0,all_people=0,mall_infect=0,pub_infect=0,casino_infect=0; //mall_infect=0;,time_mall=0;,mall_people=0; | |
| int mall=0,pub=0,casino=0; | |
| int time_mall=0,time_pub=0,time_casino=0; | |
| int mall_people=0,pub_people=0,casino_people=0; | |
| bool infected; | |
| int alcohol=0,mask=0,vacine=0; | |
| float gold=400; | |
| string place; | |
| string state[8]={"1.Mall","1","2.Pub","2","3.Casino","3","4.SHOP","4"}; | |
| Mall mall_1{}; | |
| Mall pub_1{}; | |
| Mall casino_1{}; | |
| srand(time(NULL)); | |
| int time_survire; | |
| time_survire=1+(rand()%800); | |
| if(time_survire<400){ | |
| time_survire+=450; | |
| } | |
| convert(time_survire,min,hour); | |
| cout<<"You have to survire for "<<hour<<" hour "<<min<<" minute for win the game!"<<endl; | |
| while(infected!=1){ | |
| if(0<mall<=2||4<=mall<6||7<=mall<9){ | |
| state[0]={"-"}; | |
| state[1]={""}; | |
| } | |
| if(mall==0||mall==3||mall==6||mall==9){ | |
| state[0]={"1.Mall"}; | |
| state[1]={"1"}; | |
| } | |
| if(0<pub<=2||4<=pub<6||7<=pub<9){ | |
| state[2]={"-"}; | |
| state[3]={""}; | |
| } | |
| if(pub==0||pub==3||pub==6||pub==9){ | |
| state[2]={"2.Pub"}; | |
| state[3]={"2"}; | |
| } | |
| if(0<casino<=2||4<=casino<6||7<=casino<9){ | |
| state[4]={"-"}; | |
| state[5]={""}; | |
| } | |
| if(casino==0||casino==3||casino==6||casino==9){ | |
| state[4]={"3.Casino"}; | |
| state[5]={"3"}; | |
| } | |
| if(alcohol>0){ | |
| cout<<"ALCOHOL GEL X"<<alcohol<<endl; | |
| } | |
| if(mask>0){ | |
| cout<<"MASK X"<<mask<<endl; | |
| } | |
| if(vacine>0){ | |
| cout<<"VACINE X"<<vacine<<endl; | |
| } | |
| cout<<"input place u want to go GOLD :"<<gold<<endl; | |
| cout<<state[0]<<endl; | |
| cout<<state[2]<<endl; | |
| cout<<state[4]<<endl; | |
| cout<<state[6]<<endl; | |
| cin>>place; | |
| if(place==state[1]){ | |
| mall++;pub++;casino++; | |
| if(pub==1){ | |
| pub--; | |
| } | |
| if(casino==1){ | |
| casino--; | |
| } | |
| cout<<"input time u stay : "; | |
| cin>>c_time; | |
| if(!cin){ | |
| cout<<"invalid input"<<endl; | |
| break; | |
| } | |
| else{ | |
| int random; | |
| random=1+(rand()%2000); | |
| if(random<1000){ | |
| random+=1000; | |
| } | |
| int infect_rand; | |
| infect_rand=1+(rand()%45); | |
| if(infect_rand<25){ | |
| infect_rand+=20; | |
| } | |
| Mall mall_1{random,infect_rand,c_time,1}; | |
| chace_meet(mall_1,pub_1,casino_1,infected,all_infected,all_people,time_mall,time_pub,time_casino,mall_infect,pub_infect,casino_infect,gold,mask,vacine,alcohol); | |
| place_mall++; | |
| mall_people+=random; | |
| } | |
| } | |
| if(place==state[3]){ | |
| pub++;mall++;casino++; | |
| if(mall==1){ | |
| mall--; | |
| } | |
| if(casino==1){ | |
| casino--; | |
| } | |
| cout<<"input time u stay :"; | |
| cin>>c_time; | |
| if(!cin){ | |
| cout<<"Invalid input"<<endl; | |
| break; | |
| } | |
| else{ | |
| int random; | |
| random=1+(rand()%500); | |
| if(random<250){ | |
| random+=250; | |
| } | |
| int infect_rand; | |
| infect_rand=1+(rand()%30); | |
| if(infect_rand<10){ | |
| infect_rand+=10; | |
| } | |
| Mall pub_1{random,infect_rand,c_time,1}; | |
| chace_meet(mall_1,pub_1,casino_1,infected,all_infected,all_people,time_mall,time_pub,time_casino,mall_infect,pub_infect,casino_infect,gold,mask,vacine,alcohol); | |
| place_pub++; | |
| pub_people+=random; | |
| } | |
| } | |
| if(place==state[5]){ | |
| casino++;mall++;pub++; | |
| if(mall==1){ | |
| mall--; | |
| } | |
| if(pub==1){ | |
| pub--; | |
| } | |
| cout<<"input time u stay :"; | |
| cin>>c_time; | |
| if(!cin){ | |
| cout<<"invalid input"<<endl; | |
| break; | |
| } | |
| else{ | |
| int random; | |
| random=1+(rand()%700); | |
| if(random<350){ | |
| random+=350; | |
| } | |
| int infect_rand; | |
| infect_rand=1+(rand()%35); | |
| if(infect_rand<15){ | |
| infect_rand+=15; | |
| } | |
| Mall casino_1{random,infect_rand,c_time,1}; | |
| chace_meet(mall_1,pub_1,casino_1,infected,all_infected,all_people,time_mall,time_pub,time_casino,mall_infect,pub_infect,casino_infect,gold,mask,vacine,alcohol); | |
| place_casino++; | |
| casino_people+=random; | |
| } | |
| } | |
| if(place==state[7]){ | |
| shop(gold,mask,vacine,alcohol); | |
| } | |
| int gate_time; | |
| gate_time=time_survire; | |
| gate_time-=all_people; | |
| convert(gate_time,min,hour); | |
| cout<<"Time survire left :"<<hour<<" hour :"<<min<<" minute"<<endl<<endl; | |
| cout<<":"<<all_people<<" all people you meet"<<endl; | |
| cout<<":"<<all_infected<<" infected people you meet"<<endl<<endl; | |
| if(place_mall>0){ | |
| convert(time_mall,min,hour); | |
| cout<<"You going to Mall "<<place_mall<<" time total time at mall :"<<hour<<" hour :"<<min<<" minute"<<endl; | |
| cout<<"All people you meet at Mall :"<<time_mall<<" Infected people you meet :"<<mall_infect<<" people"<<" from :"<<mall_people<<" people"<<endl<<endl; | |
| } | |
| if(place_pub>0){ | |
| convert(time_pub,min,hour); | |
| cout<<"You going to PUB "<<place_pub<<" time total time at pub :"<<hour<<" hour :"<<min<<" minute"<<endl; | |
| cout<<"All people you meet at Pub :"<<time_pub<<" Infected people you meet :"<<pub_infect<<" people"<<" from :"<<pub_people<<" people"<<endl<<endl; | |
| } | |
| if(place_casino>0){ | |
| convert(time_casino,min,hour); | |
| cout<<"You going to Casino "<<place_casino<<" time total time at casino :"<<hour<<" hour :"<<min<<" minute"<<endl; | |
| cout<<"All people you meet at Casino :"<<time_casino<<" Infected people you meet :"<<casino_infect<<" people"<<" from :"<<casino_people<<" people"<<endl<<endl; | |
| } | |
| convert(all_people,min,hour); | |
| cout<<"Total time:"<<hour<<" hour :"<<min<<" minute"<<endl; | |
| if(gate_time<=0){ | |
| cout<<"U win U have survire!"<<endl; | |
| break; | |
| } | |
| cout<<"\n\n\n"; | |
| }//while | |
| if(infected==1){ | |
| cout<<"U got the COVID-19 Virus! U lose!!"<<endl; | |
| } | |
| cout<<"PONLO MANGO"<<endl; | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment