好了!此系列汉字版本结束!(因为这个系列太简单了)
——不对!好歹给个代码:
#include#include #include #include #include #include #include #include using namespace std; int 关卡 = 0; int x, y; int a, b; string 汉字1, 汉字2; void 读取() { ifstream 输入("save.txt"); 输入 >> 关卡; return; } void 保存() { ofstream 输出("save.txt"); 输出 << 关卡; return; } int main() { 读取(); while (true) { x = rand() % 10 + 1; y = rand() % 39 + 1; if (关卡 == 0) { 汉字1 = "汩"; 汉字2 = "汨"; } if (关卡 == 1) { 汉字1 = "汆"; 汉字2 = "氽"; } if (关卡 == 2) { 汉字1 = "匚"; 汉字2 = "匸"; } if (关卡 == 3) { 汉字1 = "口"; 汉字2 = "囗"; } if (关卡 == 4) { 汉字1 = "市"; 汉字2 = "巿"; } if (关卡 == 5) { 汉字1 = "赢"; 汉字2 = "羸"; } if (关卡 == 6) { 汉字1 = "己"; 汉字2 = "已"; } if (关卡 == 7) { 汉字1 = "妹"; 汉字2 = "妺"; } if (关卡 == 8) { 汉字1 = "戍"; 汉字2 = "戌"; } if (关卡 == 9) { 汉字1 = "亳"; 汉字2 = "毫"; } cout << "找不同——" << 关卡 + 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 << 汉字2 << " "; } else { cout << 汉字1 << " "; } } } cout << "请依次输入行数、列数:"; cin >> a >> b; if (a == x && b == y) { cout << "正确!" << endl; Sleep(2000); system("cls"); 关卡++; 保存(); } else { cout << "错误!" << endl; Sleep(2000); system("cls"); continue; } if (关卡 == 11) { 保存(); break; } } return 0; }
接下来呢我是会把它“翻译”了,然后可能会整个大项目,或者整个其他的。
期待着吧!


![C++找汉字游戏[1.0汉字版本] C++找汉字游戏[1.0汉字版本]](http://www.mshxw.com/aiimages/31/718433.png)
