首页 > 编程语言 > 详细

c++

时间:2021-08-25 23:49:21      阅读:31      评论:0      收藏:0      [点我收藏+]

c++的模糊查找

输入的关键词即为一个字符数组(字符串),本文将以"abcdef"这个字符串为例。要想完成对片段的查询

根据姓名模糊查找

void findByName(InterntBar& bar) {
string str;
cout << "请输入您想要搜索的姓名:";
cin >> str;
vector<Information> list = bar.findByName(str);
for (auto& c : list) {
cout << c.info() << endl;
}
}

根据分组模糊查找

void findByGroup(InterntBar& bar) {
string str;
cout << "请输入您想要展示的分组:";
cin >> str;
vector<Information> list = bar.findByGroup(str);
for (auto& c : list) {
cout << c.info() << endl;
}
}
string Information::info()
{
ostringstream oss;
oss  << "||名字:" << name<< "||会员类别:" << group << endl;
return oss.str();
}

 

c++

原文:https://www.cnblogs.com/ywxz/p/15186718.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!