c 语言判断链表有环,c ++链表_c遍历链表_判断链表是否有环(6)

#include#include#include#define N 10typedef struct nodechar name[20];struct node *link;stud;stud * creatint nstud *p,*h,*s;int i;ifhstud *mallocsizeofstudNULLprintf"不能分配内存空间!";exit0;h-name[0]'\0';h-linkNULL;ph;fori0;iN;I++ifs stud * mallocsizeofstudNULLprintf"不能分配内存空间!";exit0;p-links;printf"请输入第%d个人的姓名",i+1;scanf"%s",s-name;s-linkNULL;ps;returnh;stud * searchstud *h,char *xstud *p;char *y;ph-link;whilep!NULLyp-name;ifstrcmpy,x0returnp;else pp-link;ifpNULLprintf"没有查找到该数据!";stud * search2stud *h,char *xstud *p,*s;char *y;ph-link;sh;whilep!NULLyp-name;ifstrcmpy,x0returns;elsepp-link;ss-link;ifpNULLprintf"没有查找到该数据!";void insertstud *pchar stuname[20];stud *s;ifs stud * mallocsizeofstudNULLprintf"不能分配内存空间!";exit0;printf"\n请输入你要插入的人的姓名:";scanf"%s",stuname;strcpys-name,stuname;s-linkp-link;p-links;void delstud *x,stud *ystud *s;sy;x-linky-link;frees;void printstud *hstud *p;ph-link;printf"数据信息为:\n";whilep!NULLprintf"%s ",&*p-name;pp-link;void quitexit0;void menuvoidclrscr;printf"\t\t\t单链表C语言实现实例\n";printf"\t\t|????????????????|\n";printf"\t\t| |\n";printf"\t\t| [1] 建 立 新 表 |\n";printf"\t\t| [2] 查 找 数 据 |\n";printf"\t\t| [3] 插 入 数 据 |\n";printf"\t\t| [4] 删 除 数 据 |\n";printf"\t\t| [5] 打 印 数 据 |\n";printf"\t\t| [6] 退 出 |\n";printf"\t\t| |\n";printf"\t\t| 如未建立新表,请先建立! |\n";printf"\t\t| |\n";printf"\t\t|????????????????|\n";printf"\t\t 请输入你的选项1-6:";mainint choose;stud *head,*searchpoint,*forepoint;char fullname[20];while1menu;scanf"%d",&choose;switchchoosecase 1:headcreatN;break;case 2:printf"输入你所要查找的人的姓名:";scanf"%s",fullname;searchpointsearchhead,fullname;printf"你所查找的人的姓名为:%s",*&searchpoint-name;printf"\n按回车键回到主菜单。

本文来自电脑杂谈,转载请注明本文网址:

http://www.pc-fly.com/a/jisuanjixue/article-33457-6.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值