fork download
  1. // kadai8-1.c
  2.  
  3. struct each_score {
  4. int ten; //点数
  5. int gou; //合格・不合格
  6. };
  7.  
  8. struct SEISEKI {
  9. char name[50];
  10. struct each_score kokugo;
  11. struct each_score sugaku;
  12. };
  13.  
  14. void check_score(int borderline, struct SEISEKI *a)
  15. {
  16. a->kokugo.gou = (a->kokugo.ten < borderline) ? 0 : 1;
  17. a->sugaku.gou = (a->sugaku.ten < borderline) ? 0 : 1;
  18. }
  19.  
  20. void print_score(struct SEISEKI a)
  21. {
  22. char *gou[] = {"rejection","accept"};
  23.  
  24. printf("name: %s\n", a.name);
  25. printf("kokugo %d : %s\n", a.kokugo.ten, gou[a.kokugo.gou]);
  26. printf("sugaku %d : %s\n", a.sugaku.ten, gou[a.sugaku.gou]);
  27. }
  28.  
  29. int main()
  30. {
  31. struct SEISEKI score[3];
  32. int i;
  33.  
  34. for (i = 0; i < 3; i++) {
  35. scanf("%49s%d%d", score[i].name, &score[i].kokugo.ten, &score[i].sugaku.ten);
  36. check_score(60, &score[i]);
  37. }
  38. for (i = 0; i < 3; i++) {
  39. print_score(score[i]);
  40. }
  41. return 0;
  42. }
  43.  
Success #stdin #stdout 0.01s 1724KB
stdin
yamauchi 60 70
yamada 30 90
tougou 70 80
stdout
name: yamauchi
kokugo 60 : accept
sugaku 70 : accept
name: yamada
kokugo 30 : rejection
sugaku 90 : accept
name: tougou
kokugo 70 : accept
sugaku 80 : accept