/** This program stores three generations of Qing Dynasty Royal family tree in a binary tree sequence and outputs the family tree. (Only the eldest son and second son are stored ). */# Include <stdio. h> # include <stdlib. h> # include <math. h ># define max_tree_size 7 typedef struct family {/* family tree info */Char name [20];} family; typedef struct sqbitree {/* binary tree */family * ELEM ;} sqbitree; int initbitree (sqbitree * l) {/* construct an empty binary tree */L-> ELEM = (Family *) malloc (max_tree_size * sizeof (family); If (! L-> ELEM) return 0; return 1;} int input (sqbitree * l) {/* Information in the input binary tree */int I; printf ("Please input names in order. \ n "); for (I = 0; I <= MAX_TREE_SIZE-1; I ++) {scanf (" % s ", L-> ELEM [I]. name);} return 1;} int output (sqbitree * l) {/* output information in the binary tree */int I; printf ("the family tree is as below. \ n "); for (I = 0; I <= MAX_TREE_SIZE-1; I ++) {printf (" % s ", L-> ELEM [I]. name); if (I = 0 | I = 2 | I = 6) printf ("\ n");} return 1;} int main () {sqbitree L; if (Initbitree (& L) = 1) {input (& L); output (& L);} elseprintf ("the space for initialization is not enough! \ N "); Return 0;}/** test case: * input: * nuerhatchi * * du nikanyuetossoto * output: * nuerkhachi * * du nikanyueto Shuo */