📄 stru_02.cpp
字号:
//stru_02.cpp
#include <iostream.h>
#include <conio.h>
struct rec
{ int chi,eng,math,total;
float ave;
}Bill; //直接定义变量
void main()
{ Bill.chi=90; //直接设置分数;
Bill.eng=80;
Bill.math=87;
Bill.total=Bill.chi+Bill.eng+Bill.math; //计算总分
Bill.ave=Bill.total/3.0; //求平均
cout << "Bill的成绩:";
cout <<"\n语文="<<Bill.chi; //输出各字段分数
cout <<"\n英语="<<Bill.eng;
cout <<"\n数学="<<Bill.math;
cout <<"\n总分="<<Bill.total;
cout <<"\n平均="<<Bill.ave<<"\n";
getch();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -