91学习

陪伴你每一天!

定义一个班级结构体,输出班级学生信息

#include <stdio.h>


struct Student{

char cName[20];

int iNumber;

char cSex;

int iGrade;

}student[5]={{"wangjiasheng",12062212,'M',3},

{"YuLongjiao",12062213,'w',3},{"JiangXuehuan",12062214,'w',3},

{"ZhangMeng",12062215,'w',3},{"HanLiang",12062216,'M',3}};

int main(){

struct Student* pStruct;

int index;

pStruct=student;

for(index=0;index<5;index++,pStruct++){

printf("NO%d student:\n",index+1);

printf("Name:%s,Number:%d\n",pStruct->cName,pStruct->iNumber);

printf("sex:%c,Grade:%d\n",pStruct->cSex,pStruct->iGrade);

printf("\n");

}

return 0;

}

加威信18790284560免费送POS机.jpg

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。