#include
#include
using namespace std;
const int nu=100;
enum Sex{Man,Woman,mid};
class Stuinf{
private:
string Name;
string Num;
enum Sex sex;
int Age;
string Address;
string Phone;
Stuinf *next;
public:
Stuinf(){Name="no name";Num="no num";sex=mid;Age=0;Address="no address";Phone="no phone";next=NULL;}
void setname(){cout>Name;}
string getname(){return Name;}
void setnum(){cout>Num;}
string getnum(){return Num;}
void setsex(){int x;cout>x;sex=(x==0)?Man:Woman;}
string getsex(){return (sex==Man)?"Man":"Woman";}
void setage(){cout>Age;while(!(0>Age;}}
int getage(){return Age;}
void setaddress(){cout>Address;}
string getaddress(){return Address;}
void setphone(){cout>Phone;}
string getphone(){return Phone;}
void setnext(Stuinf *stu){next=stu;}
Stuinf* getnext(){return next;}
~Stuinf(){};
};
int main(){
Stuinf *head=new Stuinf();Stuinf *st[nu];int i;
int n;
cout>n;
while(!(0>n;
}
while(n){
switch (n){
case 1:{
int num;
cout>num;
for(i=0;isetname();
st[i]->setage();
st[i]->setnum();
st[i]->setphone();
st[i]->setaddress();
st[i]->setsex();
st[i]->setnext(head->getnext());
head->setnext(st[i]);
}
break;
}
case 2:{
Stuinf* p;
p=new Stuinf();
p->setname();
p->setage();
p->setnum();
p->setphone();
p->setaddress();
p->setsex();
p->setnext(head->getnext());
head->setnext(p);
break;
}
case 3:{
string number;
cout>number;
Stuinf* p;Stuinf* q;
p=head;
if(head->getnext()==NULL) coutgetnum()!=number){
q=p;
p=p->getnext();
}
if(p->getnext()==NULL)
coutsetnext(p->getnext());
p->~Stuinf();
cout>na;
Stuinf * p=head->getnext();
while(p){
if(p->getname()==na) break;
p=p->getnext();
}
if(p==NULL) coutgetname()getnum()getage()getaddress()getsex()getphone()>na;
Stuinf * p=head->getnext();
while(p){
if(p->getname()==na) break;
p=p->getnext();
}
if(p==NULL) coutsetname();
coutsetnum();
coutsetage();
coutsetaddress();
coutsetsex();
coutsetphone();
cout>n;
}
}。
全部