#include <stdio.h>
typedef struct {
int kokugo;
int suugaku;
int eigo;
float heikin;
} kousa;
kousa calcHeikin(kousa in)
{
in.heikin = (in.kokugo
+ in.suugaku + in.eigo) / 3.0;
return in;
}
int main()
{
kousa a;
a.kokugo = 50;
a.suugaku = 70;
a.eigo;
a = calcHeikin(a);
printf(“国語の得点: %3dn”,a.kokugo);
printf(“数学の得点: %3dn”, a.suugaku);
printf(“英語の得点: %3dn”, a.eigo);
printf(“平均点 : %5.1fn”, a.heikin);
}
http://www.cc.kyoto-su.ac.jp/~yamada/pB/struct.html#struct