#include<iostream>
#include<bits/stdc++.h>
#include<cmath>
#include<iomanip>
#include<windows.h>
#define endl "\n"
#define A 150
using namespace std;
long long int i,j,k,a[15],sj,b[15],d,db=0,xz,bs;
long long int p[15],cp1,cp2,tx,bf1,bf2,day=1;
long long int pp[A],gs=250,sl,su=1,xz1,x1,sg=250;
bool q1,ll=true;
void datdh(int all){
	Sleep(2000);
	system("cls");
	cout<<"                    "<<endl;
	cout<<"                    "<<endl;
	cout<<"                    "<<endl;
	cout<<"  o                 "<<endl;
	Sleep(400);
	system("cls");
	cout<<"                    "<<endl;
	cout<<"                    "<<endl;
	cout<<"    o               "<<endl;
	cout<<"                    "<<endl;
	Sleep(400);
	system("cls");
	cout<<"                    "<<endl;
	cout<<"     o              "<<endl;
	cout<<"                    "<<endl;
	cout<<"                    "<<endl;
	Sleep(400);
	system("cls");
	cout<<"      o             "<<endl;
	cout<<"                    "<<endl;
	cout<<"                    "<<endl;
	cout<<"                    "<<endl;
	Sleep(400);
	system("cls");
	cout<<"       o            "<<endl;
	cout<<"                    "<<endl;
	cout<<"                    "<<endl;
	cout<<"                    "<<endl;
	Sleep(400);
	system("cls");
	cout<<"        o           "<<endl;
	cout<<"                    "<<endl;
	cout<<"                    "<<endl;
	cout<<"                    "<<endl;
	Sleep(400);
	system("cls");
	cout<<"                    "<<endl;
	cout<<"         o          "<<endl;
	cout<<"                    "<<endl;
	cout<<"                    "<<endl;
	Sleep(400);
	system("cls");
	cout<<"                    "<<endl;
	cout<<"                    "<<endl;
	cout<<"          o         "<<endl;
	cout<<"                    "<<endl;
	Sleep(400);
	system("cls");
	cout<<"                    "<<endl;
	cout<<"                    "<<endl;
	cout<<"                    "<<endl;
	cout<<"           o        "<<endl;
	Sleep(400);
	system("cls");
	cout<<"                    "<<endl;
	cout<<"                    "<<endl;
	cout<<"                    "<<endl;
	cout<<"                    "<<endl;
	Sleep(400);
	system("cls");
	cout<<"                    "<<endl;
	cout<<"                    "<<endl;
	cout<<"                    "<<endl;
	cout<<"                    "<<endl;
	Sleep(400);
	system("cls");
	cout<<"                    "<<endl;
	cout<<"                    "<<endl;
	cout<<"                    "<<endl;
	cout<<"  o                 "<<endl;
	Sleep(1000);
	system("cls");
	cout<<"第";
	Sleep(1000);
	system("cls");
	cout<<"第"<<all;
	Sleep(1000);
	system("cls");
	cout<<"第"<<all<<"天";
	Sleep(1000);
	system("cls");
}
struct wp{
	string wn;
	int jg;
};
struct bb{
	string nz;
	int sl;
};
wp a1[A];
bb a2[A];
wp a3[A];
void cs(){
	a1[1]={"铅笔",3};
	a1[2]={"橡皮",2};
	a1[3]={"草",10};
	a1[4]={"土",5};
	a1[5]={"木头",4};
	a1[6]={"铁锭",30};
	a1[7]={"铁钉",2};
	a1[8]={"铜线",10};
	a1[9]={"铜锭",20};
    a1[10]={"铝片",10};
    a1[11]={"铝块",100};
    a1[12]={"钻石",500};
    a1[13]={"黄金锭",2000};
    a1[14]={"黄金块",20000};
    a1[15]={"钛合金锭",5000};
    a1[16]={"钛合金块",50000};
    a1[17]={"面包",5};
    a1[18]={"大米",25};
    a1[19]={"一把塑料袋",5};
    a1[20]={"杯子",5};
	a1[21]={"金坷垃",100};
    a1[22]={"可乐",5};
    a1[23]={"纸",10};
    a1[24]={"作业",10};
    a1[25]={"D老师的糖果",100000};
    a1[26]={"炸药",100};
    a1[27]={"邓鱼",20};
    a1[28]={"鱼项航(只是鱼名)",10};
    a1[29]={"橘子",5};
    a1[30]={"香蕉",5}; 
}
void bg(){
	Sleep(1000);
	system("cls");
	while(1){
	cout<<"格子:"<<gs<<"/"<<sg<<endl; 
	for(i=1;i<=su;++i){
		if(a2[i].sl<=0){
		}else{
			cout<<a2[i].nz<<" 数量:"<<a2[i].sl<<endl;
		}
	}
	cout<<"扣1,买格"<<endl;
	cout<<"扣2,退出"<<endl;
	cin>>xz;
	if(xz==1){
		cout<<"输入你想买的格数(10G/格)"<<endl; 
		cin>>sl;
		Sleep(1000);
	    system("cls");
		if(db<(sl*10)){
			for(i=1;i<=10000;++i){
				Sleep(1);
				cout<<"撒B!没钱别买!"<<endl;
			}
			
			
			return ;
		}else{
			cout<<"机付包减"<<(sl*10)<<"G";
			db-=(sl*10);
			Sleep(1000);
	        system("cls");
			cout<<"格子加  "<<sl;
			sg+=sl;
			gs+=sl;
			Sleep(1000);
		} 
	}
	if(xz==2){
		Sleep(1000);
	    system("cls");
	    break;
	}
	system("cls");	
	}
	 
}
void sxmm(){
	int sb;
	for(i=1;i<=7;++i)pp[i]=0;
	srand(time(0));
	for(i=1;i<=7;++i){
		q1=true;
		sb=rand()%30+1;
		for(j=1;j<=i;j++){
			if(sb==pp[j]){
				i--;break;q1=false;
			}
		} 
		pp[i]=sb;
		if(q1==false){
			continue;
		}
		a3[i]=a1[sb];
	}
	srand(time(0));
	for(i=1;i<=7;i++){
		sb=rand()%2+1;
		if(sb==1){
			sb=rand()%a3[i].jg;
			a3[i].jg+=sb;
		}
		if(sb==2){
			sb=rand()%a3[i].jg;
			a3[i].jg-=sb;
		}
	}
}
void mm(){
	Sleep(1000);
	system("cls");
	while(1){
		cout<<"每天都会刷新"<<endl;
		cout<<"机付包:"<<db<<"G"<<endl;
	for(i=1;i<=7;++i){
		cout<<"扣"<<i<<",购买或出售  "<<a3[i].wn<<" 价格:"<<a3[i].jg<<"G"<<endl;
	}
	cout<<"扣8,打开背包"<<endl;
	cout<<"扣9,退出"<<endl;
	cin>>xz;
	if(xz<=7){
		Sleep(1000);
	    system("cls");
	    cout<<"扣1,购买"<<endl;
		cout<<"扣2,出售"<<endl;
		cin>>xz1;
		if(xz1==1){
			cout<<"输入想买的数量"<<endl;
		    cin>>sl;
		if(db-(sl*a3[xz].jg)<0){
			Sleep(1000);
	        system("cls");
	        cout<<"G不够"<<endl;
	        Sleep(1000);
	        system("cls");
	        cout<<"你被踢出去了"<<endl;
	        return ;
		}else if(gs<sl){
			Sleep(1000);
	        system("cls");
			cout<<"你不能买那么多"<<endl; 
			Sleep(1000);
			continue;
		}
		Sleep(1000);
	    system("cls");
		cout<<"机付包减"<<sl*a3[xz].jg<<"G"<<endl;
		db-=(sl*a3[xz].jg);
		Sleep(1000);
	    system("cls");
	    cout<<"背包加 "<<a3[xz].wn<<"X"<<sl;
	    gs-=sl;
	    for(i=1;i<=su;++i){
	    	if(a2[i].nz==a3[xz].wn){
	    		a2[i].sl+=sl;break;
			}else if(i==su){
				a2[i].nz=a3[xz].wn;
				a2[i].sl=sl;
				su++;
				break;
			}
		}
		} 
		if(xz1==2){
			cout<<"输入你想卖的数量"<<endl;
			cin>>sl;
			for(i=1;i<=su;++i){
				if(a2[i].nz==a3[xz].wn){
					x1=i;break;
				}else if(i==su){
					Sleep(1000);
	                system("cls");
	                cout<<"你没有这个物品"<<endl;
	                Sleep(1000);
	                system("cls");
	                cout<<"你被踢出去了"<<endl;
	                Sleep(1000);
	                system("cls");
	                return ;
				}
			}
			if(a2[x1].sl<sl){
				Sleep(1000);
	            system("cls");
				cout<<"你没有那么多"<<endl;
				Sleep(1000);
	            system("cls");
				continue;
				Sleep(1000);
	            system("cls");
			}
			Sleep(1000);
	    	system("cls");
			cout<<"机付包加"<<sl*a3[xz].jg<<"G"<<endl;
			db+=(sl*a3[xz].jg);
			Sleep(1000);
	   	    system("cls");
	    	cout<<"背包减 "<<a2[x1].nz<<"X"<<sl;
	   	    gs+=sl;
	   	    a2[x1].sl-=sl;
		}
		Sleep(1000);
	    system("cls"); 
	}
	if(xz==8){
		bg();
	}
	if(xz==9){
		break;
	}
	system("cls");	
	}	
}
void jz(){
	for(i=1;i<=100;++i){
		cout<<"  G币人生"<<endl;
			cout<<"加载中......."<<endl<<setw(5)<<right<<i<<"%"<<endl;
			for(j=1;j<=i/10;++j){cout<<"█";}
			Sleep(200+i*10);
			system("cls");
	}
	cout<<"  G币人生"<<endl;
	cout<<"加载完成!!!"<<endl<<setw(5)<<right<<"100%"<<endl;
	for(j=1;j<=10;++j){cout<<"█";} 
	system("cls");
}
void kt(){
for(i=5;i>=1;--i){cout<<"  G币人生"<<endl;cout<<setw(5)<<i<<"S";Sleep(1000);system("cls");} 
system("cls");
jz();
cout<<"欢迎来到G币人生"<<endl;
Sleep(2000);
cout<<"这里你需要通过不同的方法赚G币"<<endl;
Sleep(3000);
system("cls"); 
cout<<"开始吧!"<<endl;
Sleep(2000);
system("cls");
cout<<"我将给你10个G币"<<endl;
db+=10; 
Sleep(2000);
cout<<"机付包到账10G"<<endl;
Sleep(3000);
system("cls");	
}
void gg(){
	Sleep(1000);
	system("cls");
	Sleep(1000);
	cout<<"广告开始";
	Sleep(1000);
	system("cls"); 
	for(i=1;i<=30;++i){
		cout<<31-i<<"s";
		Sleep(1000);
		system("cls");
	}
	cout<<"0s";
	Sleep(2000);
	system("cls");
	cout<<"机付包到账5G";
	db+=5;
	Sleep(1000);
	system("cls"); 
}
void kp(){
	Sleep(1000);
	system("cls");
	cout<<"出G(赢了你将得两倍)"<<endl;
	bf1=0;bf2=0; 
	cin>>bs;
	if(db<bs){
	cout<<"余额不足";
	Sleep(1000);
    system("cls");
    cout<<"你被踢出去了!!!";
	Sleep(1000);
    system("cls"); 
    return;
    }
    db-=bs;
    cout<<"机付包减"<<bs<<"G"<<endl;
    Sleep(1000);
    system("cls");
    cout<<"规则:"<<endl;
	cout<<"你将得到5张牌,你可以出任意一张,只能出有的,4>3>2>1,1可以干掉4"<<endl; 
	system("pause");
    system("cls");
    srand(time(0));
    for(i=1;i<=5;++i){
    	p[i]=rand()%4+1;
	}
	srand(time(0));
	for(i=1;i<=5;++i){
		Sleep(1000);
		system("cls");
		cout<<"对方:你 "<<bf1<<":"<<bf2<<endl; 
		cout<<"第"<<i<<"回合";
		tx=0;
		Sleep(2000);
        system("cls");
        srand(time(0)); 
		cp1=rand()%2+1;
		srand(time(0)); 
		if(cp1==1){
			cp1=rand()%3+1;
		}
		if(cp1==2){
			cp1=rand()%4+1;
		}
		for(j=1;j<=5;++j){
			if(p[j]!=0){
			cout<<p[j]<<" ";	
			}
		}
		cout<<endl;
		while(1){
			if(tx==1){
			cout<<"再次";	
			}
			tx=0;
		cout<<"出牌"<<endl;
		cin>>cp2;
		for(j=1;j<=5;++j){
			if(p[j]==cp2){
				break;
			}else{
				if(j==5){
					cout<<"不能出没有的牌"<<endl;tx=1;
				}
			}
		}
		if(tx==0){
			for(j=1;j<=5;++j){
				if(p[j]==cp2){
					p[j]=0;break;
				}
			}
			break;
		}	
		}
		Sleep(500);
        system("cls");
		cout<<"?对方   你?";
		Sleep(500);
        system("cls");
        cout<<"  对?   ? ";
		Sleep(500);
        system("cls");
        cout<<"  对方"<<cp1<<" "<<cp2<<"你";
		Sleep(500);
        system("cls");
        if(cp1<cp2){
        	if(cp1==1&&cp2==4){
        		cout<<"  对方"<<cp1<<"  "<<"你";tx=1;
			}else{
				cout<<"  对方"<<"  "<<cp2<<"你";tx=0;
			}
		}
		if(cp1>cp2){
        	if(cp1==4&&cp2==1){
        		cout<<"  对方"<<"  "<<cp2<<"你";tx=0;
			}else{
				cout<<"  对方"<<cp1<<"  "<<"你";tx=1;
			}
		}
		if(cp1==cp2){
			cout<<"  对方"<<"   "<<"你";tx=2;
		}
		Sleep(1000);
        system("cls");
		if(tx==1){
			cout<<"这回合你输了";
			bf1++; 
		}
		if(tx==0){
			cout<<"这回合你赢了";
			bf2++; 
		}
		if(tx==2){
			cout<<"这回合平局";
		}
	}
	Sleep(2000);
	system("cls");
	    if(bf1>bf2){
			cout<<"你输了";
			bf1++; 
		}
		if(bf1<bf2){
			cout<<"你赢了"<<endl;
			bf2++; 
			Sleep(1000);
			cout<<"机付包到账"<<bs*2<<"G";
			db+=(bs*2);
			Sleep(1000);
		}
		if(bf1==bf2){
			cout<<"平局"<<endl;
			Sleep(1000);
			cout<<"机付包到账"<<bs<<"G";
			db+=bs;
			Sleep(1000);
		} 
}
void hm(){
	for(i=1;i<=10;++i){
		a[i]=0;
	}
Sleep(1000);
system("cls");
d=0;
srand(time(0));
cout<<"输入你想买的被数,1为1倍,2为2倍"<<endl;
cin>>bs;
if(db<bs){
	cout<<"余额不足";
	Sleep(1000);
    system("cls");
    cout<<"你被踢出去了!!!";
	Sleep(1000);
    system("cls"); 
    return;
}
db-=bs;
cout<<"机付包减"<<bs<<"G"<<endl;
Sleep(1000);
system("cls"); 
cout<<"每对上一个你卖彩票的G乘2(第一次为你卖彩票的G)"<<endl;
cout<<"输入你的号码(6位,0~20)"<<endl;
cin>>b[1]>>b[2]>>b[3]>>b[4]>>b[5]>>b[6];
Sleep(1000);
system("cls");
cout<<"5秒后开奖";
Sleep(1000); 
system("cls");
for(i=4;i>=1;i--){
	cout<<i<<"s";
	Sleep(1000); 
system("cls");
}
for(i=1;i<=6;++i){
	sj=rand()%20;
		for(k=1;k<=20;++k){
			a[i]=k;
			if(k==sj){
				system("cls");break;
			}
			cout<<setw(2)<<setfill('0')<<a[1]<<" "<<setw(2)<<setfill('0')<<a[2]<<" "<<setw(2)<<setfill('0')<<a[3]<<" "<<setw(2)<<setfill('0')<<a[4]<<" "<<setw(2)<<setfill('0')<<a[5]<<" "<<setw(2)<<setfill('0')<<a[6];
			system("cls");
		}
	
}
for(i=1;i<=6;++i)cout<<setw(2)<<setfill('0')<<a[i]<<" ";
for(i=1;i<=6;++i){
	if(a[i]==b[i]){
		if(d==0){
			d+=bs;
		}else{
			d*=2;
		}
	}		
}
cout<<endl;
d*=bs;
for(i=1;i<=6;++i)cout<<setw(2)<<setfill('0')<<b[i]<<" ";
cout<<endl;
cout<<"你得"<<d<<"个G币"<<endl;
db+=d;
system("pause");
system("cls");	
} 
int main(){
//kt();
cs();	
sxmm();
system("cls"); 
while(1){
if(ll==false){
	cout<<"开发者模式"<<endl;
	day=1;
}
cout<<"第"<<day<<"天"<<endl;
cout<<"剩余"<<20-day<<"天"<<endl; 
cout<<"机付包:"<<db<<"G"<<endl;
cout<<"扣1,卡牌对战"<<endl;
cout<<"扣2,彩票"<<endl;
cout<<"扣3,广告"<<endl;
cout<<"扣4,买卖"<<endl;
cout<<"扣5,下一天"<<endl;
cin>>xz;
if(xz==1){
	kp(); 
}
if(xz==2){
hm();	
}
if(xz==3){
	gg();
}
if(xz==4){
	mm();
}
if(xz==5){
	Sleep(1000);
	system("cls");
	day++;
	sxmm();
	datdh(day);
}
if(xz==114514){
	Sleep(10000);
	system("cls");
	cout<<"开发者模式"<<endl;
    Sleep(2000);
    cout<<"机付包到账100000000G"<<endl;
	db+=100000000;
	Sleep(2000);
	ll=false;
	gs+=1000000;
	sg+=1000000;
}
if(day==20){
	Sleep(1000);
	system ("cls");
	cout<<"游戏结束"<<endl;
	cout<<"你一共赚了"<<db<<"G"<<endl;
	return 0;
}
system("cls");	
}
return 0;
}