fork download
  1. #include <stdio.h>
  2.  
  3. struct student {
  4. int id; /* 学籍番号 */
  5. int eng; /* 英語 */
  6. int math; /* 数学 */
  7. int sci; /* 理科 */
  8. };
  9.  
  10. int main() {
  11.  
  12. struct student s1 = {17001, 60, 100, 20};
  13. struct student s2;
  14.  
  15. int total;
  16.  
  17. s2 = s1;
  18.  
  19. total = s2.eng + s2.math + s2.sci;
  20.  
  21. printf("学籍番号:%d 英語:%d 数学:%d 理科:%d 合計:%d\n",
  22. s2.id, s2.eng, s2.math, s2.sci, total);
  23.  
  24. return 0;
  25. }
Success #stdin #stdout 0s 5292KB
stdin
Standard input is empty
stdout
学籍番号:17001 英語:60 数学:100 理科:20 合計:180