Which people helped me compile the following procedures?

xiaoxiao2021-03-06  63

The following procedures are in 26 mistakes! // * Newspaper 031 *** Data Structure Job * //// * Establishing a Binary Tree Deep Weight * // #include #include #include int Commend, Ord void ctree () {struct tNode {Int Val, Order; int Depth; struct tnode * lchild, * rChild, * parent;} struct tnode * p, * q, * rt;

Printf ("Input Command Character, 1 Left, 2 Right, 3 Exit"); Scanf ("% D", & Commend); if (Commend! = 1 && Commend! = 2 && Commend! = 3) {Printf ("ORDER OUT OF STCH! "); Break;} switch (commend) {case 1: while (p-> lchild) p = p-> lchild; rt = (tnode *) malloc (sizeof (tnode)); rt-> parent = p; rt-; -> ORDER = Q-> ORDER 1; Printf ("Enter the value of the new node:"); scanf ("% d", & rt-> val); rt-> depth = p-> depth 1; p -> lchild = rt; q = rt; ctree (); break; cas 2: while (p-> rchild) p = p-> rchild; rt = (tnode *) malloc (sizeof (tnode); rt-> Parent = P; RT-> ORDER = Q-> ORDER 1; Printf ("Enter the value of the new node:"); scanf ("% d", & rt-> val); rt-> depth = p-> DEPTH 1; P-> rchild = rt; q = rt; ctree (); Break; Case 3: Break;} VIS (Struct Tnode * POS) {IF (Pos-> Depth> ORD) ORD = POS-> Depth Printf ("Now the maximum node number is:% D / N depth is:% D" POS-> ORDER, ORD); Printf ("The value of the node is:% D", POS-> VAL); TRAN (STRUCT TNODE * BASE) {base = root; IF (base-> lchild) {base = base-> lchild; tran (base);} VIS (root); if (base-> rchild) {base = base-> rchild; tran (base);}} main (Base);}} main ) {int ORD; Struct TNode * Q, * RT, * root; root = = = (tnode *) malloc (sizeof (tnode)); rt-> depth = 1;

转载请注明原文地址:https://www.9cbs.com/read-82179.html

New Post(0)