C 语言实例 – 使用结构体(struct) 2021年12月7日 20:53:432021年12月7日C语言教程评论1,936 雨后池塘,个人日记空间!点击进入» C 语言实例 - 使用结构体(struct) 使用结构体(struct)存储学生信息。 实例 #include <stdio.h> struct student { char name[50]; int roll; float marks; } s; int main() { printf("输入信息:\n"); printf("名字: "); scanf("%s", s.name); printf("编号: "); scanf("%d", &s.roll); printf("成绩: "); scanf("%f", &s.marks); printf("显示信息:\n"); printf("名字: "); puts(s.name); printf("编号: %d\n",s.roll); printf("成绩: %.1f\n", s.marks); return 0; } 输出结果为: 输入信息: 名字: nowcoder 编号: 123 成绩: 89 显示信息: 名字: nowcoder 编号: 123 成绩: 89.0 历年同日文章 12 月7 2020Windows必装软件IDM(优秀下载工具)v6.38.14 完美**版 点赞 登录收藏 https://www.gongshiku.com/html/202112/c-yuyanshili-shiyongjiegoutistruct.html 复制链接 复制链接 运营不易, 感谢支持! 我的微信 微信号已复制 我的微信公众号 我的微信公众号扫一扫 我的公众号 公众号已复制