修练者
#include<iostream>
#include<ctime>
#include<windows.h>
#include<string>
using namespace std;
int main(){
for(int i=1;i<=100;i+=5){
cout<<i<<"%"<<endl;
cout<<"请勿沉迷于游戏"<<endl<<"制作:三思有限公司";
Sleep(100);
system("cls");
}
cout<<endl<<"游戏加载完成! ";
Sleep(1000) ;
system("cls");//清空屏幕
cout<<"欢迎进入三思猜数游戏! "<<endl;
Sleep(5000);
int a,hp;
string s="Game over! ! ! ";
int minn=1,maxn=20;
while(1){
srand((int)time(NULL));
long long int ans=minn+rand( )%(maxn- minn+1);
hp=5;
for(int i=1;i<=hp;i++){
cout<< "HP:"<<hp+1-i<<endl;
cout<<"请输入一个在"<<minn<<"到"<<maxn<<"之间的整数" <<endl;
cin>>a;
if(a==1234){
cout<<"恭喜你,猜到了我们的彩蛋;你将获得额外HP。"<<endl;
hp+=10;
}
else if(a==ans&&i==1){
cout<<"哇!你是幸运之神吗?一下就猜对了!~(0\/0)~";
break;
}
else if(a==ans){
cout<<"猜对了,你好棒!~(*o*)~";
break;
}
else if(a>ans&&i<hp){
cout<<"不好意思,猜大了!继续猜吧! \n";
}
else if(a<ans&&i<hp){
cout<<"不好意思,猜小了!继续猜吧! \n";
}
else{
for(int j=0;j<s.size();j++){
cout<<s[j];
Sleep(300);
}
cout<<"\n正确答案其实是"<<ans<<"你差一点就猜对了~(*o*)~";
break;
}
}
char jx;
cout<<"\n继续游戏请输入Y ,输入其他字符退出游戏\n";
cin>>jx;
if(jx!='Y'){
cout<<"Bye~Bye~啦"<<endl;
system("pause");
break;
}
else{
system("cls");
}
}
return 0;
}
资深光能