1. /*-------------------------------------------------------
    2. 【程序填空】
    3. ---------------------------------------------------------
    4. 题目:程序通过定义并赋初值的方式,利用结构体变量存储了一名学生的信息。
    5. 函数fun的功能是输出这位学生的信息。
    6. -------------------------------------------------------*/
    7. #include <stdio.h>
    8. typedef struct
    9. {
    10. int num;
    11. char name[9];
    12. char sex;
    13. struct { int year,month,day ;} birthday;
    14. float score[3];
    15. }STU;
    16. /***********SPACE***********/
    17. void show(STU tt)
    18. {
    19. int i;
    20. printf("\n%d %s %c %d-%d-%d", tt.num, tt.name, tt.sex,
    21. tt.birthday.year, tt.birthday.month, tt.birthday.day);
    22. for(i=0; i<3; i++)
    23. /***********SPACE***********/
    24. printf("%5.1f", tt.score[i]);
    25. printf("\n");
    26. }
    27. main( )
    28. {
    29. STU std={ 1,"Zhanghua",'M',1961,10,8,76.5,78.0,82.0 };
    30. printf("\nA student data:\n");
    31. /***********SPACE***********/
    32. show(std);
    33. }