ex1.c

来自「零基础单片机C语言设计全套教程」· C语言 代码 · 共 22 行

C
22
字号
#include <stdio.h>						//头文件
struct lesson							//声明结构lesson
{
float Chinese;							//语文成绩
float English;							//英语成绩
float Math;							//数学成绩
};
struct student							//声明结构student
{
int 	num;								//学号
char name[20];							//姓名
char sex[2];							//性别
int 	age;								//年龄
struct lesson result;						//各科成绩
}Bob={110,"Bob", "M",21,{91.5,77.5,97.0}};

void main()							//主函数
{
printf("%d %s %s %d %f %f %f \n",			//输出结构变量的各成员值
Bob.num, Bob.name, Bob.sex, Bob.age, Bob.result.Chinese, Bob.result.English, Bob.result.Math);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?