//// / / / / Software Name: Guess number 1.0 //// Author: OWL / / / / Time: 2004.10.21 // //: Ming: Generate four non-repetitive 0- No number of 9, //////////bit of the player, the computer is compared to the input comparison of information, and the information similar to XAYB is given, A represents the number and the corresponding position /////> is correct, B Indicates that the number is correct, but the location is incorrect. I // // use x, y to represent two situations, completely correct, display "OK" /// If the input 10 times has not yet obtained correct results. If the game failed, /// The program will output the base.
// / /// # include #include #include #include #include using namespace std; const INT vec_size = 4; const Int err_max = 10; int play (void); int main (void) {bool stat = true; srand (null); coup << "Welcome to join guess digital game!" << Endl; while (stat == true) {cout << " Press Y to enter the game, press any key to exit: "; char c = cin.get (); if (c == 'y') play (); else stat = false;} system (" pause); return 0; } const vector & rand_data (vector & a) {for (int i = 0; i & a, const vector ) > & v) {INT x = 0, y = 0; for (int i = 0; I
COUT << x << "a" << Y << "B" << Endl; Return False;} BOOL ISDIGIT (INT ELEM) {char c = '0'; const Int Step = C - 0; return isdigit ELEM STEP);} constor & in (Vector & V) {cout << "Please enter the four numbers (0-9) that do not repeat (0-9), split in space!" << Endl; for (INT i = 0; i > v [i]; for (int i = 0; i > v [i];} for (int J = 0; J > v [i]; --I;}} return v;} void out (Vector & a, bool stat) {if (stat == false) {cout << "you lose .