#include#include #include using namespace std; void Start(); void GetResults(); int i, j, life, maxrand,n,h,d; char c; void Start() { i = 0; j = 0; life = 0; maxrand = 6; cout << "这是游戏的难度,选一个吧:n"; // the user has to select a difficutly level cout << "1 : 简单 (0-15)n"; cout << "2 : 中等 (0-30)n"; cout << "3 : 困难 (0-50)n"; cout << "4 : 地狱 (0-100)n"; cout << "5 : 自虐 (0-10000)n"; cout << "选择一个难度"< > c; // read the user's choice cout << "n"; switch (c) { case '1': maxrand = 15; // the random number will be between 0 and maxrand break; case '2': maxrand = 30; break; case '3': maxrand = 50; break; case '4': maxrand = 100; break; case '5': maxrand = 10000; break; default: exit(0); break; } life = 5; // number of lifes of the player srand((unsigned)time(NULL)); // init Rand() function j = rand() % maxrand; // j get a random value between 0 and maxrand if(maxrand>=1)cout<<"开挂要输入密码。密码是:"< >n; if(n!=123654) cout<<"密码错误!"< >h; if(h!=12365412)cout<<"密码错了,很遗憾!你不能开外挂,你不是卢本伟!"< > i; if((i>maxrand) || (i<0)) { // if the user number isn't correct, restart cout << "计算错误!!! n" << maxrand; GetResults(); } if(i == j) { cout << "你赢了!nn"; // the user found the secret number Start(); } else if(i>j) { cout << "太大了n"; life = life - 1; cout << "你的次数: " << life << "nn"; GetResults(); } else if(i 代码如上
用DEV c++打的
有外挂
运行时的外挂密码(对应第一个和第二个)1,123654 2,12365412



