⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 student_info.cpp

📁 Accelerated C++ 课后练习题 本人自己完成、可供参考
💻 CPP
字号:
#include"Student_info.h"
using namespace std;
bool compare(const Student_info& x,const Student_info& y)
{
	return x.name<y.name;
}
istream& read(istream& is,Student_info& s)
{
	//read an store th student's name and midterm and final exam grades
	is>>s.name>>s.midterm>>s.final;
	read_hw(is,s.homework);			//read and store all the students homework grades
	return is;
}
//read homework grades from an input stream into a 'vector'
istream& read_hw(istream& in,vector<double>& hw)
{
	if(in)
	{
		//get rid of previous contents
		hw.clear();

		//read homework grades
		double x;
		while(in>>x)
			hw.push_back(x);
		
		//clear the stream so that input will work for the next student
		in.clear();
	}
	return in;
}

⌨️ 快捷键说明

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