C++游戏篇6“简简单单,测个手速”

终于有时间发博客了

开头

千万不要看到最后

Listen say have people hand is fast(听说有人手速很快).请大家测个手速

代码

#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
double a=0.0,b=0.0;
long long m,n,CS=300;
bool f=true,f2=false;
void S(int ForgC, int BackC) {
	WORD wColor = ((BackC & 0x0F) << 4) + (ForgC & 0x0F);
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), wColor);
}
void G(int x,int y){
	COORD pos={x,y};
	HANDLE hOut=GetStdHandle(STD_OUTPUT_HANDLE);
	SetConsoleCursorPosition(hOut,pos);
	return ;
}
void kuang(){
	S(15,0);
	for(int i=1;i<=3;i++){
		for(int j=1;j<=27;j++){
			if(i==1&&j==1)cout<<"┍";
			else if(i==1&&j==27)cout<<"┑";
			else if(i==3&&j==1)cout<<"┕";
			else if(i==3&&j==27)cout<<"┙";
			else if(i==1||i==3)cout<<"┅";
			else if(j==1||j==27)cout<<"┆";
			else cout<<" ";
		}
		cout<<endl;
	}
	if(a>0.0){
		printf("  %.1lf %%\n",a);
		cout<<"   时间   "<<n-m<<"          \n";
		cout<<"平均每秒按 ";
		if(a/(100.0/CS)/(n-m)<=3.5)S(12,0);
		else if(a/(100.0/CS)/(n-m)<=5.5)S(14,0);
		else S(11,0);
		printf("  %.1lf",a/(100.0/CS)/(n-m));
		S(15,0);
		cout<<"下鼠标          \n";
	}else{
		printf("  %.1lf %%\n",0.0);
		cout<<"   时间   "<<0<<"          \n";
		cout<<"平均每秒按 ";
		S(12,0);
		printf("  %.1lf",0.0);
		S(15,0);
		cout<<"下鼠标          \n";
	}
	
}
void sz(){
	long long n;
	system("cls");
	S(15,0);
	cout<<"按夺少下过关?"<<endl;
	cout<<"原:";
	S(11,0);
	cout<<CS;
	S(15,0);
	cout<<"   ";
	cout<<"现:";
	S(12,0);
	cin>>n;
	S(15,0);
	if(n<25||n>750){
		S(12,0);
		cout<<"你不能这样设置!\n  范围:25-750";
		Sleep(1145);
		return sz();
	}
	CS=n;
}
void js(){
	system("cls");
	cout<<"按";
	S(11,0);
	cout<<CS;
	S(15,0);
	cout<<"下鼠标左键方可过关,(就是咸着没逝)";
	S(15,0);
	cout<<"按空格返回";
	Sleep(114);
	while(!(GetAsyncKeyState(VK_SPACE)))continue;
}
int kt(){
	system("cls");
	printf("\n\n  ┍┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┑\n");
	printf(" ┆     1.开始费手     ┆\n");
	printf(" ┆┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┆\n");
	printf(" ┆     2.游戏设置     ┆\n");
	printf(" ┆┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┆\n");
	printf(" ┆     3.游戏介绍     ┆\n");
	printf(" ┆┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┆\n");
	printf(" ┆     4.退出游戏     ┆\n");
	printf("  ┕┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┙ \n");
	int n;
	cin>>n;
	if(n==1){
		system("cls");
		cout<<"那就开始吧!";
		Sleep(1000);
		return 1; 
	}else if(n==2){
		sz();
		return kt();
	}else if(n==3){
		js();
		return kt();
	}else if(n==4){
		return 4;
	}else{
		cout<<"听不清楚,该罚!!!";
		Sleep(1145);
		return kt();
	}
}
int main(){
	while(true){
		a=0.0;
		f2=false;
		f=true;
		if(kt()==4){
			system("cls");
			cout<<"\n\n   ##########\n";
			cout<<"   #退出成功#\n";
			cout<<"   ##########\n";
			Sleep(3000);
			return 0;
		}
		m=time(0);
		while(a<99.999){
			G(0,0);
			kuang();
			G(1,1);
			for(int i=1;i<=(int)(a/4)+1;i++){
				if(a<=33.3)S(12,0);
				else if(a<=66.6)S(14,0);
				else S(11,0);
				if((int)a-(i*4-4)<4){
					if((int)a-(i*4-4)==0)cout<<" ";
					else if((int)a-(i*4-4)==1)cout<<"▎";
					else if((int)a-(i*4-4)==2)cout<<"▍";
					else if((int)a-(i*4-4)==3)cout<<"▋";
				}else cout<<"▉";
				S(15,0);
			}
			if(GetAsyncKeyState(VK_LBUTTON)){
				if(f2==false)m=time(0);
				f2=true;
				if(f){
					a+=100.0/CS;
					f=false;
					b=0.02;
				}
			}else if(b==0)f=true;
			if(b<=0.01)b=0;
			else b-=0.01;
			Sleep(20);
			if(f2)n=time(0);
		}
		system("cls");
		cout<<endl<<endl<<endl;
		Sleep(500);
		string s="你过关!\n";
		for(int i=0;i<=s.size()-1;i++){
			cout<<s[i];
			Sleep(20);
		}
		Sleep(1145);
		s="多谢师叔!\n";
		for(int i=0;i<=s.size()-1;i++){
			cout<<s[i];
			Sleep(20);
		}
		Sleep(1145);
	}
	return 0;
}

                                                                                  神金

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值