recordlist.h
来自「用面向连接的TCP实现学生信息的管理」· C头文件 代码 · 共 52 行
H
52 行
// RecordList.h: interface for the RecordList class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_RECORDLIST_H__1395B74D_3760_4ADC_90D2_332711BEAB40__INCLUDED_)
#define AFX_RECORDLIST_H__1395B74D_3760_4ADC_90D2_332711BEAB40__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include<iostream>
#include<fstream>
#include<string>
#include<list>
#include<cstdlib>
#include <iomanip>
using namespace std;
struct Record
{
string no;
string name;
int score;
};
class RecordList:public list<Record*>
{
friend ostream& operator<<(ostream& os,const RecordList& c_rl) //从输出到文件(重载输出)
{
RecordList::const_iterator it;//只读
for(it=c_rl.begin( ); it!= c_rl.end(); ++it)
os<<(*it)->no<<' '
<<(*it)->name<<' '
<<(*it)->score<<endl;
return os;
}
public:
RecordList();
virtual ~RecordList() ;
void clear();
iterator erase(iterator where)
{
delete *where; //释放指针指向的对象
return list<Record*>::erase(where); //释放指针
}
};
#endif // !defined(AFX_RECORDLIST_H__1395B74D_3760_4ADC_90D2_332711BEAB40__INCLUDED_)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?