📄 9-7-2.c
字号:
#include <stdio.h> //头文件
struct student //定义结构
{
char *name; //姓名
int num; //学号
int age; //年龄
char *sex; //性别
float score; //分数
}boy[4]={ //初始化
{"Bob",101,24,"M",90.0},
{"Jack",102,25,"M",88.5},
{"Twis",103,23,"M",78.5},
{"Bohm",104,21,"M",82.5}};
void main() //主函数
{
struct student *pstu; //定义结构指针
printf("Name\tNum\tAge\tSex\tscore\n"); //输出
for(pstu=boy;pstu<boy+4;pstu++) //输出各元素的成员值
printf("%s\t%d\t%d\t%s\%f\n",(*pstu).name,(*pstu).num,pstu->age,pstu->sex,pstu->score);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -