📄 address.cpp
字号:
#include <iostream>
#include <string>
#include "address.h"
#include "AddressList.h"
#include "AddressBook.h"
int main()
{
new AddressBook; //开启通信表
return 0;
}
ostream& operator<<(ostream& os,const RecordList& c_rl)
{
RecordList::const_iterator it;
RecordList::const_iterator it_end =c_rl.end();
for(it=c_rl.begin();it!=it_end;it++)
{
os<<(*it)->name << "\n" << (*it)->tel << "\n";
}
return os;
}
istream& operator>>(istream& is,RecordList& rl)
{
Record* rec;
string name;
while(true)
{
//之一这里使用的是全局的getline()函数,而不是istream 的成员函数
//全局的getline()函数将从istream中取出最后一个分隔符
//而istream的成员函数getline则不会
getline(is,name);
if(name =="")
break;
rec =new Record;
rec->name=name;
getline(is,rec->tel);
rl.push_back(rec);
}
return is;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -