Mathematics 1201: Programming in C Reading and Homework Assignment #9 Prof. Wickerhauser Due 27 October 1999 You are encouraged to collaborate on homework, and to work additional exercises from the indicated problem sections, although the homework grade will be based only on the exercises listed below. Please return your solutions to me by the end of class. LATE HOMEWORK WILL NOT BE ACCEPTED. Read Chapters 9 and 10 of the textbook. Do Exercises 10 and 15 of Chapter 10, pp. 292--293. Extra Problem 1. What will the following program print? #include #include typedef struct { char *Title; char *Author; int Pages; int YearPublished; } Book; int main(void) { Book text = {"Efficient C Programming", "Mark Allen Weiss", 529, 1995}; char *ptr; ptr = text.Author; do { if( isupper(*ptr) ) printf("%c. ", *ptr); } while(*ptr++); printf("\n"); return 0; } Extra Problem 2. What will the following program print? #include typedef struct Child { char *Name; struct Child *Mother; struct Child *Father; } Child; void show_parents(Child *A) { if(A) printf("%s's mom is %s, dad is %s\n", A->Name, A->Mother ? A->Mother->Name : "unknown", A->Father ? A->Father->Name : "unknown"); return; } int main(void) { Child X={"Hillary"}, Y={"Bill"}, Z={"Chelsea"}; Z.Mother = &X; Z.Father = &Y; show_parents(&X); show_parents(&Y); show_parents(&Z); return 0; }