#include<iostream>
#include<vector>
#include<string>
#include<map>
using namespace std;
//结构体
struct Msg
{
//构造函数
Msg();
Msg(int,const char*,const char*);
int id;
string name;
string tel;
};
Msg::Msg()
{
}
Msg::Msg(int i,const char* n,const char* t):id(i),name(n),tel(t)
{
}
bool operator==(Msg& m,Msg& g)
{
if(m.id==g.id && 0==m.name.compare(g.name) && 0==m.tel.compare(g.tel))
return true;
else
return false;
}
ostream& operator<<(ostream& output,Msg& g)
{
output<<g.id<<'\t';
output<<g.name<<'\t';
output<<g.tel<<'\t';
}
//初始化-(A-Z)
void InitRecord(map< char,vector<Msg> > & rec)//初始化
{
rec['@']=vector<Msg>();//不能识别的
char ch='A';
for(;ch<='Z';ch++)
{
rec[ch]=vector<Msg>(); //rec[key]=value;
}
}
//打印 首字母
void show(map<char,vector<Msg> >&rec)//显示所有人数据
{
map<char,vector<Msg> >::iterator the;
vector<Msg>::iterator va_the;
for(the=rec.begin();the!=rec.end();the++)//迭代器指向是元素(key_value)
{
va_the=the->second.begin();
#include<vector>
#include<string>
#include<map>
using namespace std;
//结构体
struct Msg
{
//构造函数
Msg();
Msg(int,const char*,const char*);
int id;
string name;
string tel;
};
Msg::Msg()
{
}
Msg::Msg(int i,const char* n,const char* t):id(i),name(n),tel(t)
{
}
bool operator==(Msg& m,Msg& g)
{
if(m.id==g.id && 0==m.name.compare(g.name) && 0==m.tel.compare(g.tel))
return true;
else
return false;
}
ostream& operator<<(ostream& output,Msg& g)
{
output<<g.id<<'\t';
output<<g.name<<'\t';
output<<g.tel<<'\t';
}
//初始化-(A-Z)
void InitRecord(map< char,vector<Msg> > & rec)//初始化
{
rec['@']=vector<Msg>();//不能识别的
char ch='A';
for(;ch<='Z';ch++)
{
rec[ch]=vector<Msg>(); //rec[key]=value;
}
}
//打印 首字母
void show(map<char,vector<Msg> >&rec)//显示所有人数据
{
map<char,vector<Msg> >::iterator the;
vector<Msg>::iterator va_the;
for(the=rec.begin();the!=rec.end();the++)//迭代器指向是元素(key_value)
{
va_the=the->second.begin();