热门

最新

红包

立Flag

投票

同城

我的

发布
qq_67645843
迷子のカカシ
3 年前
trueqq_67645843

打卡今日学习成果;
使用结构体表示学生的基本信息(姓名,学号,籍贯,C语言考试成绩),对其进行输入输出
/*
* 1_stu.c
* 使用结构体表示学生的基本信息(姓名,学号,籍贯,C语言考试成绩),对其进行输入输出
*
*/

#include <stdio.h>

int main(int argc, char **argv)
{
struct student
{
char name[20];
int id;
char province[20];
int C_score;
};
struct student stu; //student为结构体名,stu为结构体变量名

printf("请输入学生的姓名:");
scanf("%s",stu.name);
printf("请输入学生的学号:");
scanf("%d",&stu.id);
printf("请输入学生的籍贯:");
scanf("%s",stu.province);
printf("请输入学生的C成绩分数:");
scanf("%d",&stu.C_score);

printf("该学生的信息为:\n姓名:%s\t学号:%d\n籍贯:%s\tC成绩分数:%d\n"
,stu.name,stu.id,stu.province,stu.C_score);

return 0;
}

CSDN App 扫码分享
分享
评论
点赞
打赏
  • 复制链接
  • 举报
下一条:
。
立即登录