通讯录c语言程序设计代码数据结构,急求通讯录管理系统(有链表的)数据结构c语言版的源代码...

这个绝对满足了你的要求了,谢谢采纳`

#include

#include

#include

class List;

class person

{

public:

friend class List;

private:

person() {next=0;}

person *next;

char name[10],tel[15];

};

class List

{

public:

List(){list=0;}

int gncd(); // 功能菜单

int print(); // 输出所有信息

int append(); // 增加一个信息

int revise(); // 根据姓名、电话修改信息

int dele(); // 根据姓名、电话删除信息

int exit(); // 退出

private:

person *end();

person *list;

};

int List::exit()

{

abort();

return 1;

}

int List::gncd()

{

cout>a;

switch(a)

{

case(1):this->append();break;

case(2):this->revise();break;

case(3):this->dele();break;

case(4):this->print();break;

case(5):this->exit();break;

}

this->gncd();

return 1;

}

int List::print()

{

if(list==0)

{

coutnext;

}

cout>p->name;

cout>p->tel;

char temp;

cout>temp;

if(temp=='y'||temp=='Y')

this->append();

if(list==0)

list=p;

else

(end())->next=p;

return 1;

}

person *List::end()

{

person *p,*q;

for(q=p=list;p;q=p,p=p->next) ;

return q;

}

int List::revise()

{

person *p=list;

char temp[20];

cout>temp;

int i=0;

while(p!=NULL)

{

if(!strcmp(p->name,temp)||!strcmp(p->tel,temp))

{

i=1;

cout>p->name;

cout>p->tel;

}

p=p->next;

}

if(i==1) cout>temp;

if(p==NULL)

coutname,temp)||!strcmp(p->tel,temp)) //要删除的结点是第一个时

{

list=p->next;

delete p;

coutname,temp)||strcmp(p->tel,temp)))

{

q=p;

p=p->next;

}

if(p==NULL) return 0;

else if(q==NULL)

coutnext=p->next;

delete p;

cout

}

return 1;

}

void main()

{

List L;

L。

gncd();

}。

全部

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值