更新内容:
1.添加成就"幸运女神盯上了你"
2.添加成就"输不起就别玩"
3.更改加载旋律
4.添加弹窗提醒
#include<bits/stdc++.h>
#include<windows.h>
#include <conio.h>
using namespace std;
bool cj[10];
int good=0;
int zdy=0;
int di=600;
void SetColorAndBackground(int ForgC, int BackC) {
WORD wColor = ((BackC & 0x0F) << 4) + (ForgC & 0x0F);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), wColor);
}
int main()
{
MessageBox(NULL,"快乐游戏吧!!!","作者的温馨提示",MB_OK);
string nemima;
for(int i=1;i<=10;i++)
cj[i]=false;
SetConsoleTitle("<<抽奖小程序 0.65>>");
CONSOLE_FONT_INFOEX cfi;
cfi.cbSize = sizeof cfi;
cfi.nFont = 0;
cfi.dwFontSize.X = 25;
cfi.dwFontSize.Y = 45;
cfi.FontFamily = FF_DONTCARE;
cfi.FontWeight = FW_NORMAL;
SetCurrentConsoleFontEx(GetStdHandle(STD_OUTPUT_HANDLE), FALSE, &cfi);
SetColorAndBackground(15,0);
cout<<"<<载入中>>"<<endl;
SetColorAndBackground(0,15);
for(int i=1;i<=5;i++){
cout<<"■";
Beep(di,300);
di+=150;
Sleep(100);
}
cout<<endl;
SetColorAndBackground(15,0);
cout<<"请按任意键开始游戏";
for(int i=1;i<=6;i++){
cout<<'.';
Sleep(100);
}
getch();
system("cls");
system("color 0F");
cout<<"输入一个新密码:";
cin>>nemima;
cout<<"创建成功!!!"<<endl;
cout<<"请按任意键..."<<endl;
getch();
system("cls");
system("color 0A");
int doubi=10;
mat:
system("color 0A");
cout<<"兜币数量:"<<doubi<<endl;
cout<<"开始游戏输入1"<<endl;
cout<<"调整语言输入2(暂不支持)"<<endl;
cout<<"询问设置输入3"<<endl;
int yes;
cin>>yes;
if(yes==1){
system("cls");
cout<<"密码思密达:";
SetColorAndBackground(0,10);
string mima;
cin>>mima;
if(mima==nemima){
system("color 0A");
cout<<"Welcome back to 兜兜的抽奖点,"<<nemima;
Beep(750,400);
Beep(800,500);
Beep(520,200);
Beep(520,825);
Sleep(500);
system("cls");
sy:
system("color 0A");
if(doubi==0){
system("cls");
cout<<"作者:兜兜"<<endl;
Sleep(500);
cout<<"你的兜币数量像蛋仔的小黄蛋...";
Sleep(300);
return 1;
}
if(doubi>=20&&cj[1]==false){
cout<<"达成成就:我是大富翁"<<endl;
Beep(500,100);
Beep(700,200);
cj[1]=true;
getch();
system("cls");
}
if(doubi==1&&cj[2]==false){
cout<<"达成成就:危机重重"<<endl;
Beep(500,100);
Beep(700,200);
cj[2]=true;
getch();
system("cls");
}
if((nemima=="兜兜"||nemima=="doudou")&&cj[3]==false){
cout<<"达成成就:作者的秘密"<<endl;
Beep(500,100);
Beep(700,200);
cj[3]=true;
getch();
system("cls");
}
if(good==1&&cj[4]==false){
cout<<"达成成就:幸运女神盯上了你"<<endl;
Beep(500,100);
Beep(700,200);
cj[4]=true;
getch();
system("cls");
}
if(zdy==1&&cj[5]==false){
cout<<"达成成就:输不起就别玩"<<endl;
Beep(500,100);
Beep(700,200);
cj[5]=true;
getch();
system("cls");
}
cout<<"简单:1"<<endl;
cout<<"一般:2"<<endl;
cout<<"困难:3"<<endl;
cout<<"自定义:4"<<endl;
cout<<"兜币:"<<doubi<<endl;
int pass;
cin>>pass;
system("cls");
if(pass==1){
srand(time(0));
int sjs;
sjs=rand()%500+1;
cout<<"请输入一个数:";
int a;
cin>>a;
doubi--;
if(a==sjs){
cout<<"你真的太NB啦!兜币+3,中中中中中奖号码是:"<<sjs;
good++;
Sleep(1000);
system("cls");
doubi+=3;
goto sy;
}
else if(abs(sjs-a)<=50){
cout<<"还八错!兜币+2,中中中奖号码是:"<<sjs;
Sleep(3000);
system("cls");
doubi+=2;
goto sy;
}
else if(abs(sjs-a)<=100){
cout<<"That\'s good,兜币+1,中奖号码是:"<<sjs;
Sleep(3000);
system("cls");
doubi++;
goto sy;
}
else{
cout<<"再接再厉! 兜币+0,"<<sjs;
Sleep(3000);
system("cls");
goto sy;
}
}
if(pass==2){
srand(time(0));
int sjs;
sjs=rand()%1000+1;
cout<<"请输入一个数:";
int a;
cin>>a;
doubi--;
if(a==sjs){
cout<<"你真的太NB啦!兜币+5,中中中中中奖号码是:"<<sjs;
good++;
Sleep(1000);
system("cls");
doubi+=5;
goto sy;
}
else if(abs(sjs-a)<=100){
cout<<"还八错!兜币+3,中中中奖号码是:"<<sjs;
Sleep(3000);
system("cls");
doubi+=3;
goto sy;
}
else if(abs(sjs-a)<=500){
cout<<"That\'s good,兜币+2,中奖号码是:"<<sjs;
Sleep(3000);
system("cls");
doubi+=2;
goto sy;
}
else{
cout<<"再接再厉! 兜币+0,"<<sjs;
Sleep(3000);
system("cls");
goto sy;
}
}
if(pass==3){
srand(time(0));
int sjs;
sjs=rand()%5000+1;
cout<<"请输入一个数:";
int a;
cin>>a;
doubi--;
if(a==sjs){
cout<<"你真的太NB啦!兜币+10,中中中中中奖号码是:"<<sjs;
good++;
Sleep(1000);
system("cls");
doubi+=10;
goto sy;
}
else if(abs(sjs-a)<=300){
cout<<"还八错!兜币+5,中中中奖号码是:"<<sjs;
Sleep(3000);
system("cls");
doubi+=5;
goto sy;
}
else if(abs(sjs-a)<=700){
cout<<"That\'s good,兜币+3,中奖号码是:"<<sjs;
Sleep(3000);
system("cls");
doubi+=3;
goto sy;
}
else{
cout<<"再接再厉! 兜币+0,"<<sjs;
Sleep(3000);
system("cls");
goto sy;
}
}
if(pass==4){
zdy++;
cout<<"中奖率:";
cout<<"1 %10 2 %5 3 %1"<<endl;
int zhong;
cin>>zhong;
system("cls");
if(zhong==1)
{
srand(time(0));
int sjs;
sjs=rand()%10+1;
cout<<"请输入一个数:";
int a;
cin>>a;
doubi--;
if(a==sjs){
cout<<"兜币+1";
doubi++;
Sleep(500);
system("cls");
goto sy;
}
else{
cout<<"兜币+0";
Sleep(500);
system("cls");
goto sy;
}
}
if(zhong==2)
{
srand(time(0));
int sjs;
sjs=rand()%20+1;
cout<<"请输入一个数:";
int a;
cin>>a;
doubi--;
if(a==sjs){
cout<<"兜币+1";
doubi++;
Sleep(500);
system("cls");
goto sy;
}
else{
cout<<"兜币+0";
Sleep(500);
system("cls");
goto sy;
}
}
if(zhong==3)
{
srand(time(0));
int sjs;
sjs=rand()%100+1;
cout<<"请输入一个数:";
int a;
cin>>a;
doubi--;
if(a==sjs){
cout<<"兜币+1";
doubi++;
Sleep(500);
system("cls");
goto sy;
}
else{
cout<<"兜币+0";
Sleep(500);
system("cls");
goto sy;
}
}
}
}
}
else if(yes==3){
system("cls");
SetColorAndBackground(15,0);
cout<<"简单模式:1~500的数 符合+3 误差(<=50)+2 误差(<=100)+1"<<endl;
cout<<"普通模式:1~1000的数 符合+5 误差(<=100)+3 误差(<=500)+2"<<endl;
cout<<"困难模式:1~5000的数 符合+10 误差(<=300)+5 误差(<=700)+3"<<endl;
cout<<"自定义模式:符合+1,不显示答案"<<endl;
cout<<"按任意键返回主页>>";
getch();
MessageBox(NULL,"看懂了吗???","作者的温馨提示",MB_OK);
system("cls");
goto mat;
}
SetColorAndBackground(15,0);
system("cls");
cout<<"\n你失败了!请检查是否有输入错误!欢迎下次再来!";
cout<<endl;
return 0;
}