The C Programming Language Chapter VII James Chen050317
7.10.1 Write the following: A function, it is a pointer to the character, and the reference to the integer is parameter, does not return the value; a pointer to this function; a function that is parameter in this pointer; and a return this Function of a pointer. Write a definition of a function that is used as a parameter in one such a pointer and returns its parameters as the return value. Void F (Char *, INT &); VOID (* G) (CHAR *, INT &); TYPEDEF VOID (* H) (CHAR *, INT &) VOID I (H); HJ (h); ------ ------------ # include
7.10.2 What does the following code mean? What is he used? TypedEf Int (INT, INT); this is a custom type that references a function, returns INT, which is referenced to two int. It can use the function as a variable, simplified using the program . Example: #include
7.10.3 Write a function similar to "Hello World!", Which uses a name as the command line parameter and writes "Hello Name". Modify this function so that it can be used as a parameter with a series of names and say hello separately. #include D: /> 7103 Aaaa Bbbbhello, AAAA! Hello, BBBB! 7.10.7 Considering struct tnode {string words; int count; tnode * left; tnode * right;}; writing a function into the TNODE tree into a new word. Write a function to print the TNODE tree. Write a function to print the TNODE tree in order of the word dictionary. #include Struct TNODE {String Word; static int count; // node number is static global variable tnode * left; tnode :: count = 0; // Initialization Tnode :: counttnode * newtnode (tnode * b) ) {TNODE * a = new TNODE; CIN >> A-> Word; A-> Right = 0; A-> COUNT ; if (A-> Count <2) A-> LEFT = 0; // First Node The left node is not 0 else {a-> left = b; // The new left node is equal to the original node b-> Right = a; // The original right node is equal to the new node} Return A;} void printt (Tnode * Temp) {INT N = Temp-> count; while (n--) {cout << SETW (10) << Temp-> Word << ":" << Temp-> Left << "," << Temp << "," << Temp-> Right << Endl; Temp = Temp-> Left;}} Void Prints (TNODE * TEMP) {Vector zzzzdddsasdyyyyffff ffff: 00370D10,00372478,00000000 yyyy: 00370C70,00370D10,00372478 sasd: 00370988,00370C70,00370D10 ddd: 00371B88,00370988,00370C70 zzzz: 00000000,00371B88,00370988dddffffsasdyyyyzzzzPress any key to continue 7.10.9 Write an encrypted program that is input from the CIN and writes the encoded character sequence to COUT. The following simple encryption mode can be used: The encryption form of the character C is C ^ Key [i], where Key is a string provided by the command line parameter. This program uses the characters in key in a loop until read full input. The original body can be obtained with the same key to re-encrypt the original text. If Key does not provide Key, it is not encrypted. #include D: /> 7109 2342a @ gad: /> 7109 a @ ga2342d: /> 7109d: /> 7.10.16 Implementation of Print, Void Print (Int Value, Int Base = 10), Base is the base, and the 16, 2-en-output output #include 192192c01100000000 Error !! Press any key to company 7.10.18 Write a step function that does not have recursive. #include 2412024120Press Any Key to Continue