输出结构体信息.c 539 B

12345678910111213141516171819202122232425
  1. #include <stdio.h>
  2. struct Student {
  3. int num;
  4. char name[50];
  5. int score[3];
  6. };
  7. int main() {
  8. int n, i;
  9. scanf("%d", &n);
  10. struct Student students[n];
  11. for (i = 0; i < n; i++) {
  12. scanf("%d %s %d %d %d", &students[i].num, students[i].name, &students[i].score[0], &students[i].score[1], &students[i].score[2]);
  13. }
  14. for (i = 0; i < n; i++) {
  15. printf("%d %s %d %d %d\n", students[i].num, students[i].name, students[i].score[0], students[i].score[1], students[i].score[2]);
  16. }
  17. return 0;
  18. }