输出成绩大于80分的学生的,姓名和成绩。

/*
输出学生的姓,成绩和家庭住址。
*/
/****
分析:
1.结构体(第九章)
2.数组(6)
3.for(5)
4.if(4,3)
5.字符数组char[]。
6.宏定义。
*/
#include<stdio.h>
#define N 4
struct student{
char name[20];
int grade;
char jtzh[20];
};
struct student stu[N]={{"huang",90,"山东"},{"liutianyi",79,"四川"},{"meihe",86,"新疆"}};
int main(){
int i;
for(i=0;i<N;i++){
    if(stu[i].grade>=80){
    printf("%s\t%d\t%s\n",stu[i].name,stu[i].grade,stu[i].jtzh);
    }
}
return 0;
}

猜你喜欢

转载自blog.csdn.net/weixin_37536336/article/details/82844185
今日推荐