#include
#include
#include
using namespace std;
class student
{
public:
string name;
string number;
string sex;
void setmsg();
};
void student::setmsg()
{
cout<<"请输入姓名:";
cin>>name;
cout<<"请输入学号:";
cin>>number;
cout<<"请输入性别:";
cin>>sex;
}
int main()
{
void function_1(vector
void function_2(vector
void function_3(vector
string k;
int i;
student temp;
vector
start://键入学生信息
temp.setmsg();
yj.push_back(temp);
cout<<"继续输入? (Y or N)";
cin>>k;
if( k=="Y" )
goto start;
begin:
system("cls");;
cout<<"请选择操作:"<
switch(i)
{
case 1: function_1(yj);system("pause");break;
case 2: function_2(yj);break;
case 3: function_3(yj);break;
case 4: exit(0);
}
goto begin;
return 0;
}
void function_1(vector
{
string p;
cout<<"输入姓名: ";
cin>>p;
for(int i=0;i
if(p==yj[i].name)
{
cout<
}
}
}
void function_2(vector
{
student q;
q.setmsg();
yj.push_back(q);
}
void function_3(vector
{
string p;
cout<<"输入姓名: ";
for(vector
{
if( p==i->name)
yj.erase(i);
}
}
有问题可以追问,希望对你有帮助