parent
792d814e0d
commit
9693a75e07
@ -0,0 +1,32 @@
|
||||
#include <stdio.h>
|
||||
#define SIZE 3
|
||||
|
||||
struct student
|
||||
{
|
||||
int id;
|
||||
float score_math;
|
||||
float score_phi;
|
||||
float score_eng;
|
||||
float sum;
|
||||
};
|
||||
|
||||
void input(struct student a[]){
|
||||
for(int i = 0; i<3;i++){
|
||||
scanf("%d",&a[i].id);
|
||||
scanf("%f",&a[i].score_math);
|
||||
scanf("%f",&a[i].score_phi);
|
||||
scanf("%f",&a[i].score_eng);
|
||||
a[i].sum = a[i].score_math + a[i].score_phi + a[i].score_eng;
|
||||
}
|
||||
for(int j = 0;j < 3;j++){
|
||||
printf("%d %.1f %.1f %.1f %.1f\n",a[j].id,a[j].score_math,a[j].score_phi,a[j].score_eng,a[j].sum);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
int main(){
|
||||
struct student studentgrade[3];
|
||||
input(studentgrade);
|
||||
return 0;
|
||||
|
||||
}
|
Loading…
Reference in new issue