#include<bits/stdc++.h> |
#include<windows.h> |
#include<conio.h> |
///////////////////////////////////////////////////////////////////////////////////////////// |
using namespace std; |
///////////////////////////////////////////////////////////////////////////////////////////// |
int n; |
int ID; //用来存储输入序号 |
int s,r=0; |
double lq=125.0; |
string USER[5],user,PSW[5],psw; |
bool sfdl= false ; //一开始没有登录 |
bool zhyw= false ; //一开始没有账号 |
bool qht; //用来存储前后台数据 |
bool sfhy= false ; |
bool dc; |
long long m=0; |
double ys; |
string spname[10]={ "电脑飞飞" , "熊猫烧香" , "金币" , "银币" , "铜币" , "会员" , "-" , "-" , "-" , "-" }; |
int spsl[10]={0,0,0,0,0,0,0,0,0,0}; |
double spjg[10]={13.2,19.4,10.0,5.0,2.0,58,0.0,0.0,0.0,0.0}; |
double f=0.0; //钱 |
double ans; |
bool symbol; |
////////////////////////////////////////////////////////////////////////////////////////////// |
/**************************打开一星APP************************************/ |
void openyxAPP( void ) |
{ |
cout<< "一星APP启动中,请稍后等待..." <<endl; |
system ( "pause" ); |
cout<< "载入服务器配置,请稍后等待..." <<endl; |
system ( "pause" ); |
cout<< "已正常启动一星APP" <<endl; |
} |
//***************************画一星APP界面********************************* |
void drawmainmenu_Q( void ) |
{ |
cout<< "\t|=================================================================================|" <<endl; |
cout<< "\t| 欢迎使用一星娱乐一体APP |" <<endl; |
cout<< "\t|---------------------------------------------------------------------------------|" <<endl; |
cout<< "\t| 01:休闲游戏 |" <<endl; |
cout<< "\t| 02:登录 |" <<endl; |
cout<< "\t| 03:注册 |" <<endl; |
cout<< "\t| 04:设置 |" <<endl; |
cout<< "\t| 05:商店 |" <<endl; |
cout<< "\t| 06:ATM |" <<endl; |
cout<< "\t| 07:关于我们 |" <<endl; |
cout<< "\t| 08:退出 |" <<endl; |
cout<< "\t|=================================================================================|" <<endl; |
} |
void drawmainmenu_H( void ) |
{ |
cout<< "\t|=================================================================================|" <<endl; |
cout<< "\t| 欢迎使用一星娱乐一体APP(后台) |" <<endl; |
cout<< "\t|---------------------------------------------------------------------------------|" <<endl; |
cout<< "\t| 01:设置 |" <<endl; |
cout<< "\t| 02:商店 |" <<endl; |
cout<< "\t| 03:ATM |" <<endl; |
cout<< "\t| 04:退出 |" <<endl; |
cout<< "\t|=================================================================================|" <<endl; |
} |
void drawxxyxmenu( void ) |
{ |
cout<< "\t|=================================================================================|" <<endl; |
cout<< "\t| 休闲游戏 |" <<endl; |
cout<< "\t|---------------------------------------------------------------------------------|" <<endl; |
cout<< "\t| 01:石头剪刀布1.0 |" <<endl; |
cout<< "\t| 02:石头剪刀布2.0(会员) |" <<endl; |
cout<< "\t| 03:口算达人 |" <<endl; |
cout<< "\t| 04:退出 |" <<endl; |
cout<< "\t|=================================================================================|" <<endl; |
} |
void drawszmenu( void ) |
{ |
cout<< "\t|=================================================================================|" <<endl; |
cout<< "\t| 设置 |" <<endl; |
cout<< "\t|---------------------------------------------------------------------------------|" <<endl; |
cout<< "\t| 01:修改密码 |" <<endl; |
cout<< "\t| 02:修改背景颜色(会员) |" <<endl; |
cout<< "\t| 03:退出 |" <<endl; |
cout<< "\t|=================================================================================|" <<endl; |
} |
void drawsdmenu_H( void ) |
{ |
cout<< "\t|=================================================================================|" <<endl; |
cout<< "\t| 商店 |" <<endl; |
cout<< "\t|---------------------------------------------------------------------------------|" <<endl; |
cout<< "\t| 01:购进商品 |" <<endl; |
cout<< "\t| 02:查看商品信息 |" <<endl; |
cout<< "\t| 03:退出 |" <<endl; |
cout<< "\t|=================================================================================|" <<endl; |
} |
void drawsdmenu_Q( void ) |
{ |
cout<< "\t|=================================================================================|" <<endl; |
cout<< "\t| 商店 |" <<endl; |
cout<< "\t|---------------------------------------------------------------------------------|" <<endl; |
cout<< "\t| 01:购买商品 |" <<endl; |
cout<< "\t| 02:查看商品信息 |" <<endl; |
cout<< "\t| 03:退出 |" <<endl; |
cout<< "\t|=================================================================================|" <<endl; |
} |
//**********************************一星APP输入序号*************************************** |
void inID( void ) |
{ |
cout<< "请输入您的选项:" ; |
cin>>ID; |
} |
//*******************************一星APP功能函数**************************************** |
void error( void ) |
{ |
system ( "cls" ); |
int EID[2]; |
string ENAME[5]={ "服务器出错" , "系统错误" , "字符串错误" , "函数出错" , "数据空间超限" }; |
srand ( time (0)); |
EID[0]= rand ()%3; |
EID[1]= rand ()%2+3; |
cout<< "APP出错,请按提示解决错误" <<endl; |
system ( "pause" ); |
cout<< "\t**********错误例表**********" <<endl; |
cout<< "\t|==========================|" <<endl; |
cout<< "\t|ID| 错误名 |" <<endl; |
cout<< "\t|--------------------------|" <<endl; |
cout<< "\t| 1|" <<setw(23)<<ENAME[EID[0]]<< "|" <<endl; |
cout<< "\t| 2|" <<setw(23)<<ENAME[EID[1]]<< "|" <<endl; |
cout<< "\t|--------------------------|" <<endl; |
cout<< "错误解决方法:创建一个名为yxerror.tst的文本文档,并在里面输入yixinAPP.exe_error/bits/stdbits_computer pass the yxapp\<\body>" <<endl; |
system ( "pause" ); |
cout<< "错误已排除!" <<endl; |
system ( "pause" ); |
system ( "cls" ); |
} |
void gmsp( void ) |
{ |
system ( "cls" ); |
cout<< "|==============================================|" <<endl; |
cout<< "| 商品信息 |" <<endl; |
cout<< "|==============================================|" <<endl; |
cout<< "| 商品编号 | 商品名称 | 价格 |" <<endl; |
cout<< "|----------------------------------------------|" <<endl; |
for ( int i=0;i<=9;i++) |
{ |
cout<< "| " <<setw(8)<<i+1<< " | " <<setw(8)<<spname[i]<< " | " <<setw(4)<<spjg[i]<< " |" <<endl; |
} |
cout<< "|==============================================|" <<endl; |
inID(); |
s=ID-1; |
if (lq-spjg[s]<0)cout<< "钱不够,购买失败。" <<endl; |
else {spsl[s]++;cout<< "购买成功!" <<endl;} |
if (ID==2&&lq-spjg[s]>=0)error(); |
if (ID==5&&lq-spjg[s]>=0)cout<< "会员码:100F0012Y" <<endl; |
system ( "pause" ); |
system ( "cls" ); |
} |
void ckspxx( void ) |
{ |
system ( "cls" ); |
cout<< "|==============================================|" <<endl; |
cout<< "| 商品信息 |" <<endl; |
cout<< "|==============================================|" <<endl; |
cout<< "| 商品编号 | 商品名称 | 价格 |" <<endl; |
cout<< "|----------------------------------------------|" <<endl; |
for ( int i=0;i<=9;i++) |
{ |
cout<< "| " <<setw(8)<<i+1<< " | " <<setw(8)<<spname[i]<< " | " <<setw(4)<<spjg[i]<< " |" <<endl; |
} |
cout<< "|==============================================|" <<endl; |
system ( "pause" ); |
system ( "cls" ); |
} |
void zc( void ) |
{ |
system ( "cls" ); |
cout<< "--------------------注册--------------------" <<endl; |
cout<< "账号:" ; |
cin>>USER[r]; |
cout<< "密码:" ; |
cin>>PSW[r]; |
cout<< "确认密码:" ; |
cin>>psw; |
srand ( time (0)); |
ID= rand (); |
cout<< "验证码:" <<ID<<endl; |
cin>>s; |
if (PSW[r]==psw) |
if (ID==s){zhyw= true ;cout<< "注册成功!" <<endl;r++;} |
else {cout<< "验证码错误!" <<endl; system ( "pause" );zc();} |
else {cout<< "密码确认错误!" <<endl; system ( "pause" );zc();} |
system ( "pause" ); |
system ( "cls" ); |
} |
void sd( void ) |
{ |
while ( true ) |
{ |
drawsdmenu_Q(); |
inID(); |
switch (ID) |
{ |
case 1:gmsp(); break ; |
case 2:ckspxx(); break ; |
case 3: return ; |
} |
} |
} |
void dl() |
{ |
system ( "cls" ); |
cout<< "--------------------登录--------------------" <<endl; |
cout<< "账号:" ; |
cin>>user; |
cout<< "密码:" ; |
cin>>psw; |
if (user!= "" &&(user==USER[0]||user==USER[1]||user==USER[2]||user==USER[3]||user==USER[4])) |
{ |
if (psw!= "" &&(psw==PSW[0]||psw==PSW[1]||psw==PSW[2]||psw==PSW[3]||psw==PSW[4])) |
{ |
if (user== "admin" ) |
qht= true ; //后台账号登录 |
else qht= false ; //前台账号登录 |
cout<< "登录成功!" <<endl; |
sfdl= true ; |
} |
else cout<< "密码错误!" <<endl; |
} |
else cout<< "系统无此注册过的账号!" <<endl; |
system ( "pause" ); |
system ( "cls" ); |
} |
void ATM( void ) |
{ |
cout<< "\tATM" <<endl; |
cout<< "--------------------------------------" <<endl; |
cout<< "当前数据:ATM存有" <<f<< "元" <<endl; |
cout<< "--------------------------------------" <<endl; |
cout<< "请输入要取走的金额:" <<endl; |
cin>>ys; |
f-=ys; |
lq+=ys; |
cout<< "---------------------------------------" <<endl; |
cout<< "ATM剩余" <<f<< "元。" <<endl; |
system ( "pause" ); |
system ( "cls" ); |
} |
void stjdb1() |
{ |
cout<< "***************石头剪刀布2.0***************" <<endl; |
cout<< "-------------------------------------------" <<endl; |
srand ( time (0)); |
int m_,n_; |
dc= true ; |
while (dc) |
{ |
cout<< "请您出招!(1.石头;2.剪刀;3.布):" ; |
cin>>n_; |
m_= rand ()%3+1; |
s=m_-n_; |
switch (m_) |
{ |
case 1:cout<< "电脑出的是石头!" <<endl; break ; |
case 2:cout<< "电脑出的是剪刀!" <<endl; break ; |
case 3:cout<< "电脑出的是布!" <<endl; break ; |
} |
switch (s) |
{ |
case -2: |
case 1:n++;cout<< "你赢了!" <<n<< "连胜!加1元" <<endl;f++; break ; |
case 0:cout<< "平局不算!" <<endl; break ; |
default :cout<< "电脑赢,你不要活了……Gane Over!" <<endl;dc= false ; break ; |
} |
|
} |
system ( "pause" ); |
system ( "cls" ); |
} |
void stjdb2() |
{ |
cout<< "***************石头剪刀布2.0***************" <<endl; |
cout<< "-------------------------------------------" <<endl; |
srand ( time (0)); |
int m_,n_; |
dc= true ; |
cout<< "你想让电脑出什么?(1.石头;2.剪刀;3.布):" ; |
cin>>m_; |
while (dc) |
{ |
cout<< "请您出招!(1.石头;2.剪刀;3.布):" ; |
cin>>n_; |
s=m_-n_; |
switch (m_) |
{ |
case 1:cout<< "电脑出的是石头!" <<endl; break ; |
case 2:cout<< "电脑出的是剪刀!" <<endl; break ; |
case 3:cout<< "电脑出的是布!" <<endl; break ; |
default :cout<< "你个疯子!" <<endl; |
} |
switch (s) |
{ |
case -2: |
case 1:n++;cout<< "你赢了!" <<n<< "连胜!加" <<n<< "元" <<endl;f+=n; break ; |
case 0:cout<< "平局不算!" <<endl; break ; |
default :cout<< "电脑赢,你不要活了……Gane Over!" <<endl;dc= false ; break ; |
} |
m_= rand ()%3+1; |
} |
system ( "pause" ); |
system ( "cls" ); |
} |
void ksdr( void ) |
{ |
cout<< "\t\t\t口算达人" <<endl; |
cout<< "--------------------------------------------------------" <<endl; |
int a; |
int b; |
srand ( time (0)); |
do |
{ |
a= rand ()%20+1; |
b= rand ()%20+1; |
if (a<=7&&b<=7) |
{ |
ans=a*b; |
cout<<a<< '*' <<b<< '=' ; |
} |
else |
{ |
if (b>a) |
{ |
ans=a+b; |
cout<<a<< '+' <<b<< '=' ; |
} |
else |
{ |
ans=a-b; |
cout<<a<< '-' <<b<< '=' ; |
} |
} |
cin>>n; |
if (ans==n) |
{ |
cout<< "强人,对!" <<endl; |
dc= true ; |
m++; |
cout<<m<< "连胜,赚了" <<m<< "元钱!" <<endl; |
f+=m; |
} |
else |
{ |
cout<< "错,你不要活了……" <<endl; |
system ( "pause" ); |
cout<< "Game Over!" <<endl; |
dc= false ; |
} |
} while (dc); |
n=0; |
system ( "pause" ); |
system ( "cls" ); |
} |
void xxyx() |
{ |
while ( true ) |
{ |
drawxxyxmenu(); |
inID(); |
switch (ID) |
{ |
case 1:stjdb1(); break ; |
case 2:stjdb2(); break ; |
case 3:ksdr(); break ; |
case 4: return ; break ; |
} |
} |
} |