//结构体程序分享
#include <stdio.h>
#include <string.h>
int main(int argc, const char * argv[]) {
struct student {
int sorce;
};
struct class {
struct student students[40];
};
struct class C[3];
int i,j,n;
n=1;
for (i = 0; i<3; i++) {
printf("请输入%d班的分数,用空格隔开每个分数",n);
for (j = 0;j<40; j++) {
scanf("%d", &(C[i].students[j].sorce));
}
n++;
}
n=1;
for (i = 0; i<3; i++) {
printf("%d班不及格的分数",n);
for (j = 0;j<40; j++) {
if (C[i].students[j].sorce<60) {
printf("%3d", (C[i].students[j].sorce));
}
}
n++;
printf("\n");
}
return 0;
}
|
|