hi,hi!今天我来给大家提供一款难度为:⭐⭐(共5星)的游戏:
不眨眼游戏!!!
我想这么简单的游戏不需要我来讲了,😅😅😅,但是有一个地方我还是要讲一下,这个计时方式可能你们不知道。
这个要用到stdio库,用来提供时间(单位:毫秒)
接下来提供代码:
#include <windows.h>
#include<stdio.h>
using namespace std;
int main() {
int a;
double b;
a = 1000;
b = 0.0;
cout<<"hi,hi!眨眼游戏来喽!"<<endl;
Sleep(3000);
cout<<"准备好了吗?" <<endl;
cout<<"3"<<endl;
Sleep(a);
cout<<"2"<<endl;
Sleep(a);
cout<<"1"<<endl;
Sleep(a);
cout<<"go!"<<endl;
while(b <= 5.0){
cout<<b<<endl;
Sleep(100);
b = b+0.1;
}
cout<<"闭眼休息一下吧,如果你刚刚没眨眼那么你获得了称号:"<<endl;
cout<<" 睁眼大师"<<endl;
Sleep(5000);
cout<<"3"<<endl;
Sleep(a);
cout<<"2"<<endl;
Sleep(a);
cout<<"1"<<endl;
Sleep(a);
cout<<"go!"<<endl;
b = 0;
while(b <= 10.0){
cout<<b<<endl;
Sleep(100);
b = b+0.1;
}
cout<<"闭眼休息一下吧,如果你刚刚没眨眼那么你获得了称号:"<<endl;
cout<<" 刚直不屈"<<endl;
Sleep(5000);
cout<<"3"<<endl;
Sleep(a);
cout<<"2"<<endl;
Sleep(a);
cout<<"1"<<endl;
Sleep(a);
cout<<"go!"<<endl;
b = 0;
while(b <= 15.0){
cout<<b<<endl;
Sleep(100);
b = b+0.1;
}
cout<<"闭眼休息一下吧,如果你刚刚没眨眼那么你获得了称号:"<<endl;
cout<<" 不是人,是鬼魂!(开个玩笑)"<<endl;
Sleep(5000);
cout<<"好啦,游戏就到这里,你能突破自己的极限吗?";
Sleep(2000);
return 0;
}
这里用到“Sleep”代码,它会让计算机等待1秒,用“Sleep”感觉的确很形象哦!😊😊😊