main.cpp

来自「文件包含了很多VC实例」· C++ 代码 · 共 53 行

CPP
53
字号
#include <iostream>
using namespace std;
struct student_info
{
  string strName;
  int chinese;
  int math;
  int english;
};
student_info student[5];
int main()
{
	cout<<"Enter the information about the students :"<<endl;
	cin>>student[0].strName;
	cin>>student[0].chinese;
	cin>>student[0].math;
	cin>>student[0].english;
	.....;                                  //输入其他学生的信息
    cin>>student[4].strName;
	cin>>student[4].chinese;
	cin>>student[4].math;
	cin>>student[4].english;
	cout<<"Show the information about the students :"<<endl;
	cout<<"Name:"<<student[0].strName;
	cout<<"Chinese performance:"<<student[0].chinese;
	cout<<"Math performance:"<<student[0].math;
	cout<<"English performance:"<<student[0].english;
	......;                                 //输入其他学生的信息
	cout<<"Name:"<<student[4].strName<<endl;
	cout<<"Chinese performance:"<<student[4].chinese<<endl;
	cout<<"Math performance:"<<student[4].math<<endl;
	cout<<"English performance:"<<student[4].english<<endl;
	cout<<"Average of Chinese : "<<
		(student[0].chinese+
		student[1].chinese+
		student[2].chinese+
		student[3].chinese+
		student[4].chinese)/5<<endl;
	cout<<"Average of Math : "<<
		(student[0].Math+
		student[1].Math+
		student[2].Math+
		student[3].Math+
		student[4].Math)/5<<endl;
	cout<<"Average of English : "<<
		(student[0].English+
		student[1].English+
		student[2].English+
		student[3].English+
		student[4].English)/5<<endl;
	cin.get();
	return 0;
}

⌨️ 快捷键说明

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