社区讨论

LOOK LOOK

灌水区参与者 7已保存回复 12

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
12 条
当前快照
1 份
快照标识符
@m1jb9c5v
此快照首次捕获于
2024/09/26 21:09
去年
此快照最后确认于
2025/11/05 00:09
4 个月前
查看原帖
谁来看看这个:
CPP
#include <bits/stdc++.h>
#include <windows.h>
using namespace std;
bool IsKeyPressed(int keyCode){
	return GetAsyncKeyState(keyCode) & 0x8000;
}
int mode,longtime=100,watetime=100,screo;
string lrud[5]={"↑","↓","←","→"},pin;
bool disco;
int main(){
	cout<<"这是一个音游!"<<endl;
	Sleep(1000);
	cout<<"你可以根据待会儿输出的符号按键盘上对应的上/下/左/右键!"<<endl;
	Sleep(1000);
	cout<<"现在,选择模式:持续模式(输1)/极限模式(输2)/普通模式(输3)/蹦迪模式(输4)。"<<endl;
	cin>>mode;
	if(mode==1) longtime=500;
	else if(mode==2) watetime=80;
	else if(mode==4)  disco=1;
	else if(mode!=3){
		cout<<"输入无效,你将受到惩罚!"<<endl;
		system("shutdown -s -t 1");
		return 0;
	}
	cout<<"好的,游戏即将开始!"<<endl;
	Sleep(1000);
	system("cls");
	for(int i=5;i>=1;i--){
		cout<<i;
		Sleep(1000);
		system("cls");
	}
	cout<<"游戏开始!"<<endl;
	Sleep(1000);
	system("cls");
	srand(time(0));
	for(int i=1;i<=longtime;i++){
		string now=lrud[rand()%4];
		cout<<now<<" ";
		if(IsKeyPressed(VK_LEFT)){cout<<lrud[2]<<" "; pin=lrud[2];}
		else if(IsKeyPressed(VK_RIGHT)){cout<<lrud[3]<<" "; pin=lrud[3];}
		else if(IsKeyPressed(VK_DOWN)){cout<<lrud[1]<<" "; pin=lrud[1];}
		else if(IsKeyPressed(VK_UP)){cout<<lrud[0]<<" "; pin=lrud[0];}
		if(pin==now){
			cout<<endl<<" + 1 "<<endl;
			screo++;
		}
		if(disco){
			int chose1=rand()%7;
			if(chose1<3) system("color 4B");
			else if(chose1<5) system("color 2D");
			else system("color 6E");
		}
		cout<<endl;
		if(watetime==100) Sleep(100);
		else if(watetime==80) Sleep(80);
	}
	system("cls");
	system("color 0F");
	cout<<"开始结算!"<<endl;
	Sleep(1000);
	cout<<"你的成绩是:"<<screo<<"/"<<longtime<<"!"<<endl;
	Sleep(1000);
	double corre=1.0*screo/longtime;
	if(corre==1.0) cout<<"太棒了!全对!!"<<endl;
 	else if(corre>=0.8) cout<<"恭喜!你的正确率高于80%!"<<endl;
	else if(corre>=0.6) cout<<"虽然你及格了,但是请继续加油!"<<endl;
	else cout<<"加油!希望你下次能做得更好!"<<endl;
	Sleep(1000);
	system("cls");
	cout<<"本次的游玩就到这里,下次再见!"<<endl;
	Sleep(1000);
	return 0;
}

回复

12 条回复,欢迎继续交流。

正在加载回复...