广工anyview试题答案(广工anyview试题答案).docVIP

  • 297
  • 0
  • 约6.67千字
  • 约 19页
  • 2017-10-06 发布于河南
  • 举报

广工anyview试题答案(广工anyview试题答案).doc

广工anyview试题答案(广工anyview试题答案)

广工anyview试题答案(广工anyview试题答案) /********** [problem 9.023] struct type defined as follows: Struct date{int year; int month; int day;}; / / define the date structure type Struct student {char name[20]; Struct date birth; / / date of birth }; The struct array s stores the names of n individuals and the date of birth. Write a function that asks for the maximum age of the N individual The name of the person who has the least date of birth. **********/ Char *oldest (student, s[], int, n) {int, J, k=0; For (j=1; jn-1; j++) {if (s[k].birth.years[j].birth.year) k=j; Else if (s[k].birth.year==s[j].birth.year) {if (s[k].birth.months[j].birth.month) k=j; Else if (s[k].birth.month==s[j].birth.month) If (s[k].birth.days[j].birth.day) k=j; } } Return s[k].name; } /********** [problem 9.033] the struct type of the date and list node is defined as follows: Struct date{int year; int month; int day;}; / / date type of structure The structure of struct / studentNode node list type {char name[10]; / / name Struct date birth; / / date of birth Struct studentNode *next; }; The struct list L stores the name and date of birth of n. Write a function, ask this n individual The name of the oldest (ie the minimum date of birth). **********/ Char *oldest (struct, studentNode, *L) / * if L is an empty table, or a null pointer null Otherwise, return the name of the oldest person in the table * / {struct, studentNode, *p; If (L==NULL) return NULL; For (p=L-next; p; =NULL; p=p-next) { If ((*p).Birth.year (*L).Birth.year) continue; If ((*p).Birth.year== (*L).Birth.year) { If ((*p).Birth.month (*L).Birth.month) continue; If ((*p),.Birth.month== (*L),.Birth.month (*p),.Birth.day= (*L),.Birth.day) continue; } L=p; } Return ((*L).Name); } /********** [problem 9.063] struct type defined as follows: Struct course {int cID; / / course number, value 0~99 Char name[10]; / / name of course Float credit; / / credit value 0~5 Int semester; / / term value of 1~8 }; The structure array C stores information about th

文档评论(0)

1亿VIP精品文档

相关文档