热门

最新

红包

立Flag

投票

同城

我的

发布
itscz
itscz
3 年前
trueitscz

作为一个c程序的初学者,今天独自尝试写了几道编程题,觉得比较生疏,大家可以交流指导,技术方法或经验均可。

CSDN App 扫码分享
分享
评论
点赞
打赏
  • 复制链接
  • 举报
下一条:
打卡今日学习成果;使用结构体表示学生的基本信息(姓名,学号,籍贯,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;}
立即登录