栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

C++找汉字游戏[1.0普通版本]

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

C++找汉字游戏[1.0普通版本]

为了节省时间,我就直接把最终的给挂出来了:

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
using namespace std;
int c = 0;
int x, y;
int a, b;
string ch_1, ch_2;
void read()
{
	ifstream in("save.txt");
	in >> c;
	return;
}
void save()
{
	ofstream out("save.txt");
	out << c;
	return;
}
int main()
{
	read();
	while (true)
	{
		x = rand() % 10 + 1;
		y = rand() % 39 + 1;
		if (c == 0)
		{
			ch_1 = "汩";
			ch_2 = "汨";
		}
		if (c == 1)
		{
			ch_1 = "汆";
			ch_2 = "氽";
		}
		if (c == 2)
		{
			ch_1 = "匚";
			ch_2 = "匸";
		}
		if (c == 3)
		{
			ch_1 = "口";
			ch_2 = "囗";
		}
		if (c == 4)
		{
			ch_1 = "市";
			ch_2 = "巿";
		}
		if (c == 5)
		{
			ch_1 = "赢";
			ch_2 = "羸";
		}
		if (c == 6)
		{
			ch_1 = "己";
			ch_2 = "已";
		}
		if (c == 7)
		{
			ch_1 = "妹";
			ch_2 = "妺";
		}
		if (c == 8)
		{
			ch_1 = "戍";
			ch_2 = "戌";
		}
		if (c == 9)
		{
			ch_1 = "亳";
			ch_2 = "毫";
		}
		cout << "找不同——" << c + 1 << endl;
		cout << "   1  2  3  4  5  6  7  8  9  10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 ";
		for (int j = 1; j <= 10; j++)
		{
			if (j >= 1 && j <= 9)
			{
				cout << j << "  ";
			}
			else
			{
				cout << j << " ";
			}
			for (int k = 1; k <= 39; k++)
			{
				if (j == x && k == y)
				{
					cout << ch_2 << " ";
				}
				else
				{
					cout << ch_1 << " ";
				}
			}
		}
		cout << "请依次输入行数、列数:";
		cin >> a >> b;
		if (a == x && b == y)
		{
			cout << "正确!" << endl;
			Sleep(2000);
			system("cls");
			c++;
			save();
		}
		else
		{
			cout << "错误!" << endl;
			Sleep(2000);
			system("cls");
			continue;
		}
		if (c == 11)
		{
			break;
		}
	}
	return 0;
}

下个系列再见!

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/737734.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号