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

长话短说,上代码:

#include <iostream>
#include <fstream>
#include <string.h>
#include <ctime>
#include <conio.h>
#include <Windows.h>
#include <thread>
#include <conio.h>
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;
}

下个系列再见!

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

H.Y_C ⁹⁹⁹⁹⁹⁹⁺

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值