本内容仅做个人记录

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>//find
#include <cstring>
using namespace std;
struct stdent{
string name;
int age;
bool operator==(const int &age){
return (this->age==age);
};
};
int main()
{
vector<stdent> stu;
stdent tmp;
for(int i=0;i<5;i++){
tmp.age=i;
if(i==3)
{
tmp.name="aaaaa";
}
else
{
tmp.name="bbbbb";
}
stu.push_back(tmp);
memset(&tmp,0,sizeof(tmp));
}
vector<stdent>::iterator it=find(stu.begin(),stu.end(),3);
cout<<it->name<<endl;


for(vector<stdent>::iterator iter=stu.begin();iter!=stu.end();++iter){
cout<<iter->age<<" "<<iter->name<<endl;
}
return 0;
}