为了节省时间,我就直接把最终的给挂出来了:
#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; }
下个系列再见!


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