#include<stdio.h>
struct Student{
char* name;
int number;
};
struct Report{
char* file;
struct Student author;
};
int len(char* file){
int i;
for(i=0; *file++; i++);
return i;
}
int main(void){
struct Report r1={"program", "Steve",30};
struct Report r2={"john_report", "John", 2};
struct Report r3={"0604","Mary",10};
struct Report a;
if(len(r1.file) > len(r2.file)){
a=r1;
r1=r2;
r2=a;
}
if(len(r2.file) > len(r3.file)){
a=r2;
r2=r3;
r3=a;
}
if(len(r1.file) > len(r2.file)){
a=r1;
r1=r2;
r2=a;
}
printf("学籍番号:%d, ファイル名:%s\n",r1.
author.
number,r1.
file); printf("学籍番号:%d, ファイル名:%s\n",r2.
author.
number,r2.
file); printf("学籍番号:%d, ファイル名:%s\n",r3.
author.
number,r3.
file); return 0;
}
I2luY2x1ZGU8c3RkaW8uaD4KCnN0cnVjdCBTdHVkZW50ewoJY2hhciogbmFtZTsKCWludCBudW1iZXI7Cn07CgpzdHJ1Y3QgUmVwb3J0ewoJY2hhciogZmlsZTsKCXN0cnVjdCBTdHVkZW50IGF1dGhvcjsKfTsKCmludCBsZW4oY2hhciogZmlsZSl7CglpbnQgaTsKCglmb3IoaT0wOyAqZmlsZSsrOyBpKyspOwoJcmV0dXJuIGk7Cn0KCmludCBtYWluKHZvaWQpewoJc3RydWN0IFJlcG9ydCByMT17InByb2dyYW0iLCAiU3RldmUiLDMwfTsKCXN0cnVjdCBSZXBvcnQgcjI9eyJqb2huX3JlcG9ydCIsICJKb2huIiwgMn07CglzdHJ1Y3QgUmVwb3J0IHIzPXsiMDYwNCIsIk1hcnkiLDEwfTsKCXN0cnVjdCBSZXBvcnQgYTsKCglpZihsZW4ocjEuZmlsZSkgPiBsZW4ocjIuZmlsZSkpewoJCWE9cjE7CgkJcjE9cjI7CgkJcjI9YTsKCX0KCglpZihsZW4ocjIuZmlsZSkgPiBsZW4ocjMuZmlsZSkpewoJCWE9cjI7CgkJcjI9cjM7CgkJcjM9YTsKCX0KCglpZihsZW4ocjEuZmlsZSkgPiBsZW4ocj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