【发布时间】:2012-02-12 09:49:29
【问题描述】:
如何使用算法按国家/地区过滤类向量 studentList?这意味着我只显示来自“美国”国家的学生的详细信息。
bool checkCountry (string x, string y)
{
return (x == y);
}
vector<Student> studentList;
studentList.push_back(Student("Tom", 'M', "91213242", "America"));
studentList.push_back(Student("Jessilyn", 'F', "98422333", "Europe"));
【问题讨论】:
-
@Oli - 仅当他想删除非美国条目时。我认为他的意思是他想保留矢量,但只显示某些元素。
-
我必须保留其他条目,所以擦除删除不起作用?
标签: c++ algorithm class vector filter