打工模拟器
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
bool bol,b[5];
int x,num=1,j=0,jno[5]={0,1,5,10,0},t;
string job[5]={"无","搬砖","上班族","领导","老板"},strx;
void headout_outshort(){
cout<<endl<<endl;
Sleep(50);
}
void headout(){
system("cls");
for(int i=1;i<=100;i++){
if(i==99){
cout<<"正在加载中 99%";
cout<<endl<<endl;
Sleep(3000);
cout<<"\033c";
}
else{
cout<<"正在加载中 "<<i<<"%";
headout_outshort();
if(i!=100) system("cls");
}
}
Sleep(1500);
system("cls");
}
void dgout_outshort(){
cout<<endl<<endl;
Sleep(1000);
}
void dgout(int ti){\
system("cls");
for(int i=1;i<=ti;i++){
if(i==ti){
cout<<"还剩 "<<1<<" 秒";
cout<<endl<<endl;
Sleep(1000);
cout<<"\033c";
}
else{
cout<<"还剩 "<<ti-i+1<<" 秒";
dgout_outshort();
system("cls");
}
}
return ;
}
bool ask(int a){
cout<<endl<<"确定支付 "<<a<<" 元?"<<endl<<endl<<"1 确定 2 取消"<<endl<<endl;
cin>>x;
if(x==1){
if(num>=a){
system("cls");
cout<<endl<<"支付成功"<<endl<<endl;
num-=a;
Sleep(1250);
system("cls");
return true;
}
else{
system("cls");
cout<<endl<<"支付失败 不够钱"<<endl<<endl;
Sleep(1250);
system("cls");
return false;
}
}
else if(x==2){
system("cls");
cout<<endl<<"支付取消"<<endl<<endl;
Sleep(1250);
system("cls");
return false;
}
else{
cout<<endl<<"请输入 1 ~ 2";
Sleep(1250);
system("cls");
return false;
}
}
void head_out_1(){
cout<<endl<<endl;
Sleep(2500);
return ;
}
void head_out_2(){
cout<<endl<<endl;
Sleep(1500);
return ;
}
void head(){
cout<<"打工模拟器 1.1.6";
head_out_1();
headout();
cout<<"欢迎来到打工模拟器";
head_out_2();
cout<<"你现在十分穷,只有 1 元";
head_out_2();
cout<<"开始打工吧"<<endl<<endl;
head_out_2();
return ;
}
void rc(){
while(1){
cout<<endl<<"请问你想要什么职业:"<<endl<<endl<<"1 搬砖 ( 1 元) 2 上班族 ( 350 元) 3 领导 ( 1000 元) 4 退出"<<endl<<endl;
cin>>x;
if(x==1){
if(!b[1]){
if(ask(1)){
b[1]=true;
bol=true;
j=1;
}
}
else {
system("cls");
cout<<endl<<"你已经购买过了"<<endl<<endl;
Sleep(1250);
system("cls");
}
break;
}
else if(x==2){
if(!b[2]){
if(ask(350)){
b[2]=true;
bol=true;
j=2;
}
}
else {
system("cls");
cout<<endl<<"你已经购买过了"<<endl<<endl;
Sleep(1250);
system("cls");
}
break;
}
else if(x==3){
if(!b[3]){
if(ask(1000)){
b[3]=true;
bol=true;
j=3;
}
}
else {
system("cls");
cout<<endl<<"你已经购买过了"<<endl<<endl;
Sleep(1250);
system("cls");
}
break;
}
else if(x==4){
return ;
}
else{
system("cls");
cout<<endl<<"请输入 1 ~ 4"<<endl<<endl;
}
Sleep(1250);
system("cls");
}
return ;
}
void gx(){
cout<<endl<<endl<<"1.0.0 游戏框架建成"<<endl<<"1.1.0 结构系统建成"<<endl<<"1.1.1 加入搬砖及打工玩法 基本玩法建成"<<endl<<"1.1.2 加入上班族及领导 等级系统建成"<<endl<<"1.1.3 优化了游戏打工玩法的内容"<<endl<<"1.1.4 修复了已知问题"<<endl<<"1.1.5 优化了开始动画 加入了更新日志"<<endl<<"1.1.6 优化了游戏的切换界面的方式"<<endl<<endl<<endl<<"版本 1.1.6"<<endl<<endl<<endl<<"总代码量 216行"<<endl<<endl<<endl<<"按任意键退出..."<<endl;
cin>>strx;
return ;
}
void dg(){
cout<<endl<<"打工多久(/秒 s):";
cin>>t;
dgout(t);
num+=t;
system("cls");
cout<<endl<<"打工结束"<<endl<<endl;
Sleep(1250);
system("cls");
return ;
}
int main(){
head();
while(1){
system("cls");
cout<<endl<<"你现在有 "<<num<<" 元"<<endl<<endl<<"你现在的职业是: "<<job[j]<<endl<<endl<<"你现在要干什么:"<<endl<<endl<<"1 人才市场 2 打工 3 更新日志 4 退出游戏"<<endl<<endl;
cin>>x;
if(x==1) rc();
else if(x==2){
if(bol) dg();
else{
system("cls");
cout<<endl<<"你还没有工作,请到人才市场购买"<<endl<<endl;
Sleep(1750);
system("cls");
}
}
else if(x==3){
gx();
}
else if(x==4){
break;
}
else{
system("cls");
cout<<endl<<"请输入 1 ~ 4"<<endl<<endl;
Sleep(1750);
system("cls");
}
}
return 0;
}