#include <stdio.h>
#include <math.h>
#define STUDENTS 5
#define EXAMS 3
typedef struct {
int id;
int math;
int english;
int physics;
double ave;
double std;
}Grades;
int main(void)
{
Grades data[]={{1,65,80,95},{2,70,68,75},{3,60,100,83},{4,100,55,74},{5,90,85,100}};
for(int i=0;i<STUDENTS;i++)
{
data[i].ave=(data[i].math+data[i].english+data[i].physics)/EXAMS;
data
[i
].
std=sqrt(((data
[i
].
math-data
[i
].
ave)*(data
[i
].
math-data
[i
].
ave)+(data
[i
].
english-data
[i
].
ave)*(data
[i
].
english-data
[i
].
ave)+(data
[i
].
physics-data
[i
].
ave)*(data
[i
].
physics-data
[i
].
ave))/EXAMS
);printf("id %d :%1f, %1f\n",data
[i
].
id,data
[i
].
ave,data
[i
].
std); }
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxtYXRoLmg+CiNkZWZpbmUgU1RVREVOVFMgNQojZGVmaW5lIEVYQU1TIDMKCnR5cGVkZWYgc3RydWN0IHsKaW50IGlkOwppbnQgbWF0aDsKaW50IGVuZ2xpc2g7CmludCBwaHlzaWNzOwpkb3VibGUgYXZlOwpkb3VibGUgc3RkOwp9R3JhZGVzOwoKaW50IG1haW4odm9pZCkKewpHcmFkZXMgZGF0YVtdPXt7MSw2NSw4MCw5NX0sezIsNzAsNjgsNzV9LHszLDYwLDEwMCw4M30sezQsMTAwLDU1LDc0fSx7NSw5MCw4NSwxMDB9fTsKZm9yKGludCBpPTA7aTxTVFVERU5UUztpKyspCnsKZGF0YVtpXS5hdmU9KGRhdGFbaV0ubWF0aCtkYXRhW2ldLmVuZ2xpc2grZGF0YVtpXS5waHlzaWNzKS9FWEFNUzsKZGF0YVtpXS5zdGQ9c3FydCgoKGRhdGFbaV0ubWF0aC1kYXRhW2ldLmF2ZSkqKGRhdGFbaV0ubWF0aC1kYXRhW2ldLmF2ZSkrKGRhdGFbaV0uZW5nbGlzaC1kYXRhW2ldLmF2ZSkqKGRhdGFbaV0uZW5nbGlzaC1kYXRhW2ldLmF2ZSkrKGRhdGFbaV0ucGh5c2ljcy1kYXRhW2ldLmF2ZSkqKGRhdGFbaV0ucGh5c2ljcy1kYXRhW2ldLmF2ZSkpL0VYQU1TKTsKcHJpbnRmKCJpZCAlZCA6JTFmLCAlMWZcbiIsZGF0YVtpXS5pZCxkYXRhW2ldLmF2ZSxkYXRhW2ldLnN0ZCk7Cn0KcmV0dXJuIDA7Cn0=