C 语言实例 - 使用结构体(struct)
C 语言教程
· 2019-02-21 10:29:47
使用结构体(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;
}
输出结果为:
输入信息: 名字: codercto 编号: 123 成绩: 89 显示信息: 名字: codercto 编号: 123 成绩: 89.0
点击查看所有 C 语言教程 文章: https://codercto.com/courses/l/17.html
Cyberwar
Kathleen Hall Jamieson / Oxford University Press / 2018-10-3 / USD 16.96
The question of how Donald Trump won the 2016 election looms over his presidency. In particular, were the 78,000 voters who gave him an Electoral College victory affected by the Russian trolls and hac......一起来看看 《Cyberwar》 这本书的介绍吧!