论如何用C++考考你的眼力#C++考眼力小游戏

原创,未经许可请勿转载!

因为时间问题,真的不能帮大家测试一下了,如果游玩时出现BUG请一定在评论区反馈(别喷就行),我一定会尽快修改!

还有好友PK功能,快来艾特你的好盆友一起测眼力叭~~~

//
//Created by Carlgood.
//
//Note:This program is written in version DEV-C++ 5.11.
# include<iostream>
# include<cmath>
# include<string>
# include<cstring>
# include<cstdio>
# include<algorithm>
# include<sstream>
# include<iomanip>
# include<vector>
# include<queue>
# include<deque>
# include<stack>
# include<stdio.h>
# include<windows.h>
# include<ctime> 
# define This_program_is_written_by_Carlgood_Programming_Studio 9876543210
using namespace std;
string s[50]={"","支","堵","拉","税","施","枯","何","鹌","裸","谁","汝","穴","回","人","曰"};
string m[50]={"","攴","琽","柆","稅","斾","秙","诃","鵪","婐","准","汶","六","囙 ","入","日"};
void wj()
{
	long long score=0;
	while(1)
	{
		system("cls");
		cout<<"Score:"<<score<<endl;
		srand(time(0));
		int a=0,b=0,c=0;
		while(!a||!b||!c)
		{
			a=rand()%10;
			b=rand()%10;
			c=rand()%15;
		}
		for(int i=1;i<=10;i++)
		{
			for(int j=1;j<=10;j++)
			{
				if(i==a&&j==b)
				{
					cout<<m[c];
				}
				else
				{
					cout<<s[c];
				}
			}
			cout<<endl;
		}
		cout<<"\n请输入错字的位置(行,列):";
		int d,e;
		cin>>d>>e;
		if(d==a&&e==b)
		{
			cout<<"正确,错别字在"<<a<<"行"<<b<<"列!\n";
			score+=10;
		}
		else
		{
			if(d==a||e==b)
			{
				score+=5;
			}
			cout<<"错误,错别字在"<<a<<"行"<<b<<"列。\n";
		}
		system("pause");
	}
	cout<<"Error!!!"; 
}
void bs()
{
	int score_a=0,score_b=0;
	bool flag=false;
	for(int i=1;i<=20;i++)
	{
		system("cls");
		if(!flag)
		{
			cout<<"请Player_A答题:\n";
			cout<<"Score-Player A:"<<score_a<<endl;
		}
		else
		{
			cout<<"请Player_B答题:\n";
			cout<<"Score-Player B:"<<score_b<<endl;
		}
		srand(time(0));
		int a=0,b=0,c=0;
		while(!a||!b||!c)
		{
			a=rand()%10;
			b=rand()%10;
			c=rand()%15;
		}
		for(int i=1;i<=10;i++)
		{
			for(int j=1;j<=10;j++)
			{
				if(i==a&&j==b)
				{
					cout<<m[c];
				}
				else
				{
					cout<<s[c];
				}
			}
			cout<<endl;
		}
		cout<<"\n请输入错字的位置(行,列):";
		int d,e;
		cin>>d>>e;
		if(d==a&&e==b)
		{
			cout<<"正确,错别字在"<<a<<"行"<<b<<"列!\n";
			if(!flag)
			{
				score_a+=10;
			}
			else
			{
				score_b+=10;
			}
		}
		else
		{
			if(d==a||e==b)
			{
				if(!flag)
				{
					score_a+=5;
				}
				else
				{
					score_b+=5;
				}
			}
			cout<<"错误,错别字在"<<a<<"行"<<b<<"列。\n";
		}
		system("pause");
		if(flag)
		{
			flag=false;
		}
		else
		{
			flag=true;
		}
	}
	cout<<"比赛结束。下面是本场比赛得分情况:\n";
	cout<<"Player A:"<<score_a<<endl;
	cout<<"Player B:"<<score_b<<endl;
	cout<<"比赛结果:\n";
	if(score_a>score_b)
	{
		cout<<"Player A获胜!\n";
	}
	else if(score_a<score_b)
	{
		cout<<"Player B获胜!\n";
	}
	else
	{
		cout<<"平局!\n";
	}
	system("pause");
	system("cls");
}
void zdy()
{
	long long a;
	cout<<"请输入您要练习的题目数:";
	cin>>a;
	system("pause");
	system("cls");
	long long score=0;
	for(int i=1;i<=a;i++)
	{
		system("cls");
		cout<<"Score:"<<score<<endl;
		srand(time(0));
		int a=0,b=0,c=0;
		while(!a||!b||!c)
		{
			a=rand()%10;
			b=rand()%10;
			c=rand()%15;
		}
		for(int i=1;i<=10;i++)
		{
			for(int j=1;j<=10;j++)
			{
				if(i==a&&j==b)
				{
					cout<<m[c];
				}
				else
				{
					cout<<s[c];
				}
			}
			cout<<endl;
		}
		cout<<"\n请输入错字的位置(行,列):";
		int d,e;
		cin>>d>>e;
		if(d==a&&e==b)
		{
			cout<<"正确,错别字在"<<a<<"行"<<b<<"列!\n";
			score+=10;
		}
		else
		{
			if(d==a||e==b)
			{
				score+=5;
			}
			cout<<"错误,错别字在"<<a<<"行"<<b<<"列。\n";
		}
		system("pause");
	}
	cout<<"练习结束,您的得分:"<<score<<"分。";
	system("pause");
	system("cls");
}
int main()
{
	//▇
	system("title 考眼力找错字V1.0--C.G.P.S");
	int asd;
	cout<<"考眼力小游戏--By C.G.P.S\n";
	cout<<"1.无尽模式 2.比赛模式 3.自定义题数\n";
	cin>>asd;
	if(asd==1)
	{
		wj();
	}
	else if(asd==2)
	{
		bs();
	}
	else if(asd==3)
	{
		zdy();
	}
	else
	{
		cout<<"Error!!!";
	}
	main();
	return 0;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值