fork download
  1. #include<stdio.h>
  2.  
  3. struct student{
  4. char name[15];
  5. int number;
  6. };
  7.  
  8. struct report{
  9. char file[15];
  10. student author;
  11. };
  12.  
  13. int main(void){
  14. report r1={"program", "Steve",30};
  15. report r2={"john report", "John", 2};
  16. report r3={"0604","Mary",10};
  17.  
  18. report a;
  19. if(r1.author.number >= r2.author.number){
  20. a=r1;
  21. r1=r2;
  22. r2=a;
  23. }
  24.  
  25. if(r2.author.number >= r3.author.number){
  26. a=r2;
  27. r2=r3;
  28. r3=a;
  29. }
  30.  
  31. if(r1.author.number >= r2.author.number){
  32. a=r1;
  33. r1=r2;
  34. r2=a;
  35. }
  36.  
  37. printf("学籍番号:%d,ファイル名:%s\n",r1.author.number,r1.file);
  38. printf("学籍番号:%d,ファイル名:%s\n",r2.author.number,r2.file);
  39. printf("学籍番号:%d,ファイル名:%s\n",r3.author.number,r3.file);
  40. }
Success #stdin #stdout 0.01s 2680KB
stdin
Standard input is empty
stdout
学籍番号:2,ファイル名:john report
学籍番号:10,ファイル名:0604
学籍番号:30,ファイル名:program