C++#include<windows.h>
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,d,x,m,o,r,z,W,u,a1,a2,www=0,a7,RD=0;
char c;
int zhongjiang1=0,zhongjiang2=0,zhandou1=0,zhandou2=0;
string s;
cout<<"欢迎来到怪物别跑小游戏1.72.1版本"<<endl;
Sleep(1000);
cout<<" ---更新公告---"<<endl;
Sleep(1000);
cout<<" 更新了个人主页"<<endl;
Sleep(1000);
cout<<" 军衔系统等级制"<<endl;
Sleep(1000);
cout<<" 感谢游玩此游戏"<<endl;
cout<<" --------------"<<endl;
Sleep(1500);
system("pause&&cls");
cout<<"请输入昵称"<<endl;
cin>>s;
if(s[0]=='S'&&s[1]=='B') {
cout<<"畵芴肀亟峱撓外...挂...苡開";
cout<<endl<<"乱码...数.值..已...最大";
m=100000;
r=10000000;
RD=4000;
}else{
cout<<"你好"<<s<<"很高兴认识你"<<endl;
cout<<"如果遇到bug,请输入3,或退出存档"<<endl;
cout<<"你获得了新手礼包,10个金币"<<endl;
m=10;
r=10;
}
while(1){
Sleep(1500);
cout<<endl;
system("pause&&cls");
cout<<"你现在想干什么?"<<endl<<"1抽奖"<<"2开始游戏"<<"3个人主页"<<"0退出游戏"<<endl;
cin>>u;
if(u==0) break;
else
cout<<"请在输入一次您的选择。"<<endl;
cin>>a;
system("pause&&cls");
if(a==3){
a7=(m+r)/2;
cout<<s<<endl;
cout<<"攻击力:"<<m<<endl;
cout<<"金币:"<<r<<endl;
cout<<"综合实力:"<<a7<<endl;
if(a7<=50)cout<<"评级:D"<<endl;
else if(a7>50&&a7<=100)cout<<"评级:C"<<endl;
else if(a7>100&&a7<=150)cout<<"评级:B"<<endl;
else if(a7>150&&a7<=170)cout<<"评级:A"<<endl;
else if(a7>170&&a7<=200)cout<<"评级:SS"<<endl;
else if(a7>200)cout<<"评级:SSS+"<<endl;
cout<<"徽章:"<<endl;
if(zhongjiang1>=1)cout<<"中奖高手*"<<zhongjiang1<<endl;
if(zhongjiang2>=1)cout<<"中奖霸王*"<<zhongjiang2<<endl;
if(zhandou1>=1)cout<<"战斗小将*"<<zhandou1<<endl;
if(zhandou2>=1)cout<<"无敌战神*"<<zhandou2<<endl<<endl;
cout<<endl<<endl<<"军衔:";
if(RD<=50&&RD<=100)cout<<"列兵 距下一阶级还差"<<101-RD<<"分";
else if(RD>100&&RD<=250)cout<<"上等兵 距下一阶级还差"<<251-RD<<"分";
else if(RD>250&&RD<=400)cout<<"下士 距下一阶级还差"<<401-RD<<"分";
else if(RD>400&&RD<=600)cout<<"中士 距下一阶级还差"<<601-RD<<"分";
else if(RD>600&&RD<=800)cout<<"下士 距下一阶级还差"<<801-RD<<"分";
else if(RD>800&&RD<=1000)cout<<"少尉 距下一阶级还差"<<1001-RD<<"分";
else if(RD>1000&&RD<=1200)cout<<"中尉 距下一阶级还差"<<1201-RD<<"分";
else if(RD>1200&&RD<=1400)cout<<"少校 距下一阶级还差"<<1401-RD<<"分";
else if(RD>1400&&RD<=1600)cout<<"中校 距下一阶级还差"<<1651-RD<<"分";
else if(RD>1600&&RD<=1850)cout<<"上校 距下一阶级还差"<<1801-RD<<"分";
else if(RD>1850&&RD<=2000)cout<<"大校 距下一阶级还差"<<2001-RD<<"分";
else if(RD>2000&&RD<=2400)cout<<"少将 距下一阶级还差"<<2401-RD<<"分";
else if(RD>2400&&RD<=3000)cout<<"中将 距下一阶级还差"<<3001-RD<<"分";
else if(RD>3000&&RD<=4000)cout<<"上将 距天将还差"<<4001-RD<<"分";
else if(RD>4000)cout<<"天将 "<<RD<<" 分";
}else if(a==1){
cout<<"您现在的金币数量是:"<<r<<endl;
cout<<"-----------------抽奖--------------------"<<endl;
cout<<"----------请输入0-10中的任意整数----------"<<endl;
cout<<"-----------------------------------------"<<endl;
cout<<"1抽一次(10金币) 2抽十次(90金币) 3抽二十次(180金币) 0返回"<<endl;
cin>>b;
system("cls");
if(b==1){
if(r>=10){
r-=10;
cout<<"金币减10"<<endl<<"你现在的金币数量是"<<r<<endl;
srand(time(0));
d=rand()%10;
cin>>b;
if(d==b){
m+=10;
cout<<"恭喜您,中奖啦!攻击力提高10点!";
}else{
cout<<"很遗憾,没中奖。攻击力不提高。";
cout<<endl<<"中奖号码是"<<d;
}
}else{
cout<<"金币不足,可以充值来获得金币。"<<endl<<"1=充值"<<endl;
cin>>a1;
if(a1==1){
cout<<"请输入您的充值金额"<<endl<<"1=10金币 2=20金币 以此类推"<<endl;
cin>>a2;
while(a2>2){
cout<<"检测到你是未成年人,您一次最多只能充值2元"<<endl<<"请重新输入您的充值金额"<<endl;
cin>>a2;
}r=a2*10;
cout<<"您现在的金币数量是"<<r;
}
}
}else if(b==2){
if(r>=90){
r-=90;
cout<<"金币减90"<<endl<<"你现在的金币数量是"<<r<<endl;
for(int i=1;i<=10;i++){
srand(time(0));
d=rand()%10;
cin>>b;
if(d==b){
www+=10;
}else{
}
}if(www>0)cout<<"共中奖了"<<www/10 <<"次,攻击力加"<<www;
else cout<<"没中奖,下次再来"<<endl;
cout<<"额外赠送一个徽章"<<endl;
cout<<"获得徽章(抽奖高手)";
zhongjiang1+=1;
www=0;
m+=www;
}else{
cout<<"金币不足,可以充值来获得金币。"<<endl<<"1=充值"<<endl;
cin>>a1;
if(a1==1){
cout<<"请输入您的充值金额"<<endl<<"1=10金币 2=20金币 以此类推"<<endl;
cin>>a2;
while(a2>2){
cout<<"检测到你是未成年人,您一次最多只能充值2元"<<endl<<"请重新输入您的充值金额"<<endl;
cin>>a2;
}
r=a2*10;
cout<<"您现在的金币数量是"<<r;
}
}
}else if(b==3){
if(r>=180){
r-=180;
cout<<"金币减180"<<endl<<"你现在的金币数量是"<<r<<endl;
for(int i=1;i<=2;i++){
for(int j=1;j<=10;j++){
srand(time(0));
d=rand()%10;
cin>>b;
if(d==b){
www+=10;
}else{
}
}
}if(www>0)cout<<"共中奖了"<<www/10 <<"次,攻击力加"<<www;
else cout<<"没中奖,下次再来"<<endl;
cout<<"额外赠送一个徽章"<<endl;
cout<<"获得徽章(中奖霸王)";
zhongjiang2+=1;
m+=www;
}else{
cout<<"金币不足,可以充值来获得金币。"<<endl<<"1=充值"<<endl;
cin>>a1;
if(a1==1){
cout<<"请输入您的充值金额"<<endl<<"1=10金币 2=20金币 以此类推"<<endl;
cin>>a2;
while(a2>2){
cout<<"检测到你是未成年人,您一次最多只能充值2元"<<endl<<"请重新输入您的充值金额"<<endl;
cin>>a2;
}
r+=a2*10;
cout<<"您现在的金币数量是"<<r;
}
}
}else break;
}else if(a==2){
cout<<"请挑选难度"<<endl<<"1=简单 2=普通 3=困难 4=地狱"<<endl;
cin>>z;
switch(z){
case 1:
srand(time(0));
x=rand()%3;
if(x==0) cout<<"怪物在你的左边";
else if(x==1) cout<<"怪物在你的右边";
else cout<<"怪物在你的前面";
cout<<endl<<"a=打左边"<<"d=打右边"<<"w=打前面"<<"s=不想玩了"<<endl;
cin>>c;
srand(time(0));
o=rand()%20;
switch(c){
case 'a':if(0==x) {cout<<"命中敌人!"<<endl<<s<<"的攻击力是"<<m;if(m>=o) {r+=10;RD+=10;cout<<",你赢了!获得10枚金币!怪物的攻击力是"<<o;}else if(m<o){cout<<",你打不过他,可以用金币抽奖来增加攻击力。"<<endl<<"怪物的攻击力是"<<o;}}else cout<<s<<"未命中敌人。";break;
case 'd':if(1==x) {cout<<"命中敌人!"<<endl<<s<<"的攻击力是"<<m;if(m>=o) {r+=10;RD+=10;cout<<",你赢了!获得10枚金币!怪物的攻击力是"<<o;}else if(m<o){cout<<",你打不过他,可以用金币抽奖来增加攻击力。"<<endl<<"怪物的攻击力是"<<o;}}else cout<<s<<"未命中敌人。";break;
case 'w':if(2==x) {cout<<"命中敌人!"<<endl<<s<<"的攻击力是"<<m;if(m>=o) {r+=10;RD+=10;cout<<",你赢了!获得10枚金币!怪物的攻击力是"<<o;}else if(m<o){cout<<",你打不过他,可以用金币抽奖来增加攻击力。"<<endl<<"怪物的攻击力是"<<o;}}else cout<<s<<"未命中敌人。";break;
case 's':break;
}break;
case 2:{
srand(time(0));
x=rand()%3;
if(x==0) cout<<"怪物在你的左边";
else if(x==1) cout<<"怪物在你的右边";
else cout<<"怪物在你的前面";
cout<<endl<<"a=打左边"<<"d=打右边"<<"w=打前面"<<"s=不想玩了"<<endl;
cin>>c;
srand(time(0));
o=rand()%50;
switch(c){
case 'a':if(0==x) {cout<<"命中敌人!"<<endl<<s<<"的攻击力是"<<m;if(m>=o) {r+=20;RD+=20;cout<<",你赢了!获得20枚金币!怪物的攻击力是"<<o;}else if(m<o){cout<<",你打不过他,可以用金币抽奖来增加攻击力。"<<endl<<"怪物的攻击力是"<<o;}}else cout<<s<<"未命中敌人。";break;
case 'd':if(1==x) {cout<<"命中敌人!"<<endl<<s<<"的攻击力是"<<m;if(m>=o) {r+=20;RD+=20;cout<<",你赢了!获得20枚金币!怪物的攻击力是"<<o;}else if(m<o){cout<<",你打不过他,可以用金币抽奖来增加攻击力。"<<endl<<"怪物的攻击力是"<<o;}}else cout<<s<<"未命中敌人。";break;
case 'w':if(2==x) {cout<<"命中敌人!"<<endl<<s<<"的攻击力是"<<m;if(m>=o) {r+=20;RD+=20;cout<<",你赢了!获得20枚金币!怪物的攻击力是"<<o;}else if(m<o){cout<<",你打不过他,可以用金币抽奖来增加攻击力。"<<endl<<"怪物的攻击力是"<<o;}}else cout<<s<<"未命中敌人。";break;
case 's':break;
}break;
}
case 3:{
srand(time(0));
x=rand()%3;
if(x==0) cout<<"怪物在你的左边";
else if(x==1) cout<<"怪物在你的右边";
else cout<<"怪物在你的前面";
cout<<endl<<"a=打左边"<<"d=打右边"<<"w=打前面"<<"s=不想玩了"<<endl;
cin>>c;
srand(time(0));
o=rand()%100;
switch(c){
case 'a':if(0==x) {cout<<"命中敌人!"<<endl<<s<<"的攻击力是"<<m;if(m>=o) {r+=50;RD+=50;cout<<",你赢了!获得50枚金币!怪物的攻击力是"<<o<<"\n额外获得勋章:战斗小将";zhandou1++;}else if(m<o){cout<<",你打不过他,可以用金币抽奖来增加攻击力。"<<endl<<"怪物的攻击力是"<<o;}}else cout<<s<<"未命中敌人。";break;
case 'd':if(1==x) {cout<<"命中敌人!"<<endl<<s<<"的攻击力是"<<m;if(m>=o) {r+=50;RD+=50;cout<<",你赢了!获得50枚金币!怪物的攻击力是"<<o<<"\n额外获得勋章:战斗小将";zhandou1++;}else if(m<o){cout<<",你打不过他,可以用金币抽奖来增加攻击力。"<<endl<<"怪物的攻击力是"<<o;}}else cout<<s<<"未命中敌人。";break;
case 'w':if(2==x) {cout<<"命中敌人!"<<endl<<s<<"的攻击力是"<<m;if(m>=o) {r+=50;RD+=50;cout<<",你赢了!获得50枚金币!怪物的攻击力是"<<o<<"\n额外获得勋章:战斗小将";zhandou1++;}else if(m<o){cout<<",你打不过他,可以用金币抽奖来增加攻击力。"<<endl<<"怪物的攻击力是"<<o;}}else cout<<s<<"未命中敌人。";break;
case 's':break;
}break;
}
case 4:{
srand(time(0));
x=rand()%3;
if(x==0) cout<<"怪物在你的左边";
else if(x==1) cout<<"怪物在你的右边";
else cout<<"怪物在你的前面";
cout<<endl<<"a=打左边"<<"d=打右边"<<"w=打前面"<<"s=不想玩了"<<endl;
cin>>c;
srand(time(0));
o=rand()%500;
switch(c){
case 'a':if(0==x) {cout<<"命中敌人!"<<endl<<s<<"的攻击力是"<<m;if(m>=o) {r+=100;RD+=100;cout<<",你赢了!获得100枚金币!怪物的攻击力是"<<o<<"\n额外获得勋章:无敌战神";zhandou2++;}else if(m<o){cout<<",你打不过他,可以用金币抽奖来增加攻击力。"<<endl<<"怪物的攻击力是"<<o;}}else cout<<s<<"未命中敌人。";break;
case 'd':if(1==x) {cout<<"命中敌人!"<<endl<<s<<"的攻击力是"<<m;if(m>=o) {r+=100;RD+=100;cout<<",你赢了!获得100枚金币!怪物的攻击力是"<<o<<"\n额外获得勋章:无敌战神";zhandou2++;}else if(m<o){cout<<",你打不过他,可以用金币抽奖来增加攻击力。"<<endl<<"怪物的攻击力是"<<o;}}else cout<<s<<"未命中敌人。";break;
case 'w':if(2==x) {cout<<"命中敌人!"<<endl<<s<<"的攻击力是"<<m;if(m>=o) {r+=100;RD+=100;cout<<",你赢了!获得100枚金币!怪物的攻击力是"<<o<<"\n额外获得勋章:无敌战神";zhandou2++;}else if(m<o){cout<<",你打不过他,可以用金币抽奖来增加攻击力。"<<endl<<"怪物的攻击力是"<<o;}}else cout<<s<<"未命中敌人。";break;
case 's':break;
}break;
}
case 0:break;cout<<"已退出游戏";
}
}
}system("cls");
cout<<"再";
Sleep(80);
cout<<"次";
Sleep(80);
cout<<"感";
Sleep(80);
cout<<"谢";
Sleep(80);
cout<<"你";
Sleep(80);
cout<<"的";
Sleep(80);
cout<<"游";
Sleep(80);
cout<<"玩!\n";
Sleep(500);
cout<<"喜";
Sleep(80);
cout<<"欢";
Sleep(80);
cout<<"就";
Sleep(80);
cout<<"笑";
Sleep(80);
cout<<"一";
Sleep(80);
cout<<"下";
Sleep(80);
cout<<"吧!\n";
Sleep(1000);
cout<<"累了就听一会音乐吧!\n";
const int _oC = 277, _oD = 311, _oF = 370, _oG = 415, _oA = 466;
const int _C = 262, _D = 294, _E = 330, _F = 349, _G = 392, _A = 440, _B = 494;
const int oC = 554, oD = 622, oF = 740, oG = 831, oA = 932;
const int C = 523, D = 578, E = 659, F = 698, G = 784, A = 880, B = 988;
const int C_ = 1047, D_ = 1175, E_ = 1319, F_ = 1397, G_ = 1568, A_ = 1760, B_ = 1976;
const int oC_ = 1109, oD_ = 1245, oF_ = 1480, oG_ = 1661, oA_ = 1865;
const int T = 400; //一拍的长度
const int Stop = 800; //一拍休止符的长度
Beep(C,T);
Beep(C,T);
Beep(G,T);
Beep(G,T);
Beep(A,T);
Beep(A,T);
Beep(G,T*2);
Beep(F,T);
Beep(F,T);
Beep(E,T);
Beep(D,T);
Beep(D,T);
Beep(C,T*2);
Beep(G,T);
Beep(G,T);
Beep(F,T);
Beep(F,T);
Beep(E,T);
Beep(E,T);
Beep(D,T*2);
Beep(G,T);
Beep(G,T);
Beep(F,T);
Beep(F,T);
Beep(E,T);
Beep(E,T);
Beep(D,T*2);
Beep(C,T);
Beep(C,T);
Beep(G,T);
Beep(G,T);
Beep(A,T);
Beep(A,T);
Beep(G,T*2);
Beep(F,T);
Beep(F,T);
Beep(E,T);
Beep(E,T);
Beep(D,T);
Beep(D,T);
Beep(C,T*4);
cout<<"再见了,"<<s<<"。";
return 0;
}