能不能帮忙用小甲鱼数据结构代码写一份关于文章编辑的代码

急!帮我编写一个c语言的数据结构程序,关于串,提供要用的代码,只要帮我实现界面上的样子_百度知道
急!帮我编写一个c语言的数据结构程序,关于串,提供要用的代码,只要帮我实现界面上的样子
c语言数据结构程序关于串操作提供串操作基本代码需实现运行结串操作按照我给框架设计编写 串.h文件谢谢我加谢谢
提问者采纳
//str.c#include&stdio.h&#include&str.h&void&main(){&int&n,flag=0;&int&i=4,j=6;&char&*str,*&str=(char*)malloc(sizeof(char)*100);&sub=(char*)malloc(sizeof(char)*100);&printf(&&&&&&&&&&&&&&&&&&&&&&&串系统&&&&&&&&&&&&&&&&&&&&&&&&&&\n&);&printf(&********************************************************\n&);&printf(&*&&&&&&&&&&&&&1---------输入字串&&&&&&&&&&&&&&&&&&&&&&&*\n&);&printf(&*&&&&&&&&&&&&&2---------连接字串&&&&&&&&&&&&&&&&&&&&&&&*\n&);&printf(&*&&&&&&&&&&&&&3---------取字串&&&&&&&&&&&&&&&&&&&&&&&*\n&);&printf(&*&&&&&&&&&&&&&4---------删除字串&&&&&&&&&&&&&&&&&&&&&&&*\n&);&printf(&*&&&&&&&&&&&&&5---------插入字串&&&&&&&&&&&&&&&&&&&&&&&*\n&);&printf(&*&&&&&&&&&&&&&6---------查找字串&&&&&&&&&&&&&&&&&&&&&&&*\n&);&printf(&*&&&&&&&&&&&&&7---------比较字串&&&&&&&&&&&&&&&&&&&&&&&*\n&);&printf(&*&&&&&&&&&&&&&8---------显示字串&&&&&&&&&&&&&&&&&&&&&&&*\n&);&printf(&*&&&&&&&&&&&&&0---------返&&&&&&&&&&&&&&&&&&&&&&&&&&&*\n&);&printf(&********************************************************\n&);&while(!flag){&printf(&请选择菜单号(0--8):&&&);&scanf(&%d&,&n);&switch(n){&case&1:printf(&please&input&your&string&:&&);scanf(&%s&,str);&case&2:strcat(str,sub);&case&3:sub=getsubstr(str,i,j);&case&4:delsubstr(str,i,j);&case&5:inssubstr(str,sub,i);&case&6:i=findsubstr(str,sub);&case&7:strcmp(str,sub);&case&8:printf(&%s\n&,str);&case&0:flag=1;&}&}}//str.h;#include&string.h&#include&stdlib.h&char*&getsubstr(char&*str,int&begin,int&end){&char&*&int&i=0,k=0;&tmp=(char*)malloc(sizeof(char)*100);&for(i=i&=i++){&&tmp[k++]=str[i];&}&tmp[k]='\0';&return&}char&*&delsubstr(char&*str,int&begin&,int&end){&char&*&tmp=&str[end+1];&str[begin]='\0';&strcat(str,tmp);&return&}char&*inssubstr(char&*str,char&*sub,int&index){&char&*&tmp=(char*)malloc(sizeof(char)*100);&strcpy(tmp,&str[index]);&str[index]='\0';&strcat(str,sub);&strcat(str,tmp);&return&}int&findsubstr(char&*str,char&*sub){&int&i,j,k;&for(i=0;i&strlen(str);i++){&&k=i;&&for(j=0;j&strlen(sub);j++){&&&if(str[k++]!=sub[j])&&&&&&}&&if(j==strlen(sub))&&&return&i;&}&return&-1;}能按照意思致做做~~~细节足~~~~~
提问者评价
其他类似问题
数据结构的相关知识
您可能关注的推广
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁求高手帮忙写一数据结构程序_百度知道
求高手帮忙写一数据结构程序
设有线形表LA=(3,5,8,11)和LB=(2,6,8,9,11,15,20)要求:若LA和LB分别亥场掇可墀玖峨雪法磨表示两个集合A和B,求新集合A=A并B(既并操作,相同元素不保留)预测输出:LA=(3,5,8,11,2,6,9,15,20)请速度帮忙谢谢急需答案
在线等答案LA LB是代码里预亥场掇可墀玖峨雪法磨置的LA LB有序LA LB是顺序表
提问者采纳
#include &iostream.h&#define MaxSize 100struct seqlist{ int data[MaxSize];};void Input(seqlist *A,int n){ for(int i=0;i亥场掇可墀玖峨雪法磨&n;i++)
cin&&A-&data[i]; A-&last=n-1;}void Print(seqlist *A){ for(int i=0;i&=A-&i++)
cout&&A-&data[i]&&& &; cout&&}int Union(seqlist *La,seqlist *Lb){
int i,j, if(La-&last+1+Lb-&last+1&MaxSize)
return(-1); for(i=0;i&=Lb-&i++) {
for(j=0; j&=La-& j++)
if(Lb-&data[i]==La-&data[j])
if(flag==0)
if(flag!=0)
La-&data[++La-&last]=Lb-&data[i]; } return 1;} void main(){ seqlist s1,s2; int n1,n2; cout&&&输入顺序表s1和s2的元素个数:&; cin&&n1&&n2; cout&&&输入s1中的数据:&; Input(&s1,n1); cout&&&输入s2中的数据:&; Input(&s2,n2); cout&&&s1中的数据为:&; Print(&s1); cout&&&s2中的数据为:&; Print(&s2); Union(&s1,&s2); cout&&&合并后s1中的数据为:&; Print(&s1);}
提问者评价
其他类似问题
高手帮忙的相关知识
其他2条回答
用一个循环b 里面的元素。 如果该元素存在于
a表里面 则不加如a 否则 加到 a 的末尾
你需要更加明确你的问题才行。首先,LA、LB哪儿来的,键盘输入的还是在代码里预置的;其次,LA、LB本身是否有序?看你给出的是升序序列。是否有序对合并操作影响比较大。最后,LA、LB的数据结构是顺序表还是链表?
您可能关注的推广回答者:
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁温州市啸秋中学新版欢迎你 >> 问答中心 >> 查看留言
温州市『啸秋中学』新版网站欢迎您的光临,并请留下您的宝贵建议!
您现在的位置:&&>&&>&查看留言
留言模式:游客模式
 查看模式:讨论区方式
 发表模式:审核发表
&&有1条待审核
共 2 条贴子&&&首页 | 上一页 | 1 | 下一页 | 尾页&10条贴子/页&&转到第页
: 20:54:46
<img src="/GuestBook/Images/Face/01.gif" width="80" height="90" onMouseOut="toolTip();" onMouseOver="toolTip(' 姓名:gm386 (男) 主页:未填 OICQ: 信箱: 地址:58.214.* 时间: 20:54:46');">
【游客】gm386
请教各位大哥大姐,我也在做一个学校的网站,备案采集什么的前期工作也做的差不多了,也在信息产业部注册了.等了个14天那个信息产业部发消息给我,内容如下(尊敬的用户:gm386,您好!若您已经有关主管部门审核同意的,请在5日内向住所所在地省通信管理局提交相关主管部门审核同意的文件;若您未经有关主管部门审核同意,请您在20天内到当地相应的教育前置审批部门办理前置审批手续。逾期不候!谢谢合作!)我下一步该怎么办啊,
<img src=/GuestBook/Images/other.gif width=45 height=16 border=0 onMouseOut=toolTip() onMouseOver="toolTip('&Icq:未填&Msn:未填&I P:58.214.*')">
共有回复1条
: 21:50:23
<img src="/GuestBook/Images/Face/01.gif" width="80" height="90" onMouseOut="toolTip();" onMouseOver="toolTip(' 姓名:木易子
主页:未填 OICQ:未填 信箱:未填 地址:60.180.* 时间: 21:50:23');">
【用户】木易子
最好先去当地的教育主管部门了解一下具体操作步骤;
听说也可以直接去电信局咨询注册的。
<img src=/GuestBook/Images/other.gif width=45 height=16 border=0 onMouseOut=toolTip() onMouseOver="toolTip('&Icq:未填&Msn:未填&I P:60.180.*')">
共 2 条贴子&&&首页 | 上一页 | 1 | 下一页 | 尾页&10条贴子/页&&转到第页
回 复 留 言
姓  名:
性  别:
个人主页:
留言主题:
现在心情:
留言内容:
小提示:换行请按Shift+Enter,另起一段请按Enter
是否隐藏:
隐藏 * 选择隐藏后,此留言只有管理员和留言者才可以看到。
&&验证码:
┋ 网站备案: ┋ 网站内核:┋ 网站维护: 
Copyright &
All Rights Reserved我在写数据结构的课程设计,要求有图,能不能帮忙写一下,我把其他写好的代码发给你
我在写数据结构的课程设计,要求有图,能不能帮忙写一下,我把其他写好的代码发给你
补充:#include &iostream.h&#include &stdlib.h&#include &conio.h&#define MAXSIZE 38 /*定义朝代量的最大值*/struct airline{ && char chaodai[55];/*朝代 */ char niandai[20];/*年代 */ char ducheng[30];/*都城 */
/*起始年代*/
/*结束年代*/}struct airline *struct airline air[MAXSIZE]={ {" & & & &夏朝 &"," 前2146 —前1675年 ","安邑",-},& & {" & & & &商朝 &"," 前1675 —前1029年 ","亳 &",-}, && & {" & & & &西周 &"," 前1029 — 前771年 ","镐京",-}, & {" & & & &东周 &"," 前770 &— 前221年 "," & &",-770,-221}, {" & & & &春秋 &"," 前770 &— 前476年 "," & &",-770,-476}, {" & & & &战国 &"," 前475 &— 前221年 "," & &",-475,-221}, {" & & & &秦朝 &"," 前221 &— 前206年 ","咸阳",-221,-206}, {" & & & &西汉 &"," 前206 &— & &25年 ","长安",-206,25}, {" & & & &东汉 &"," & 25 & — & 220年 ","洛阳",25,220}, {" & & & &三国 &"," & 220 &— & 280年 "," & &",220,280}, {" & & & &魏国 &"," & 220 &— & 265年 ","洛阳",220,265}, {" & & & &蜀国 &"," & 221 &— & 263年 ","成都",221,263}, {" & & & &吴国 &"," & 222 &— & 280年 ","建业",222,280}, {" & & & &西晋 &"," & 265 &— & 317年 ","洛阳",265,317}, {" & & & &东晋 &"," & 317 &— & 420年 ","建康",317,420}, {" & & & &十六国 "," & 304 &— & 439年 ","平阳",304,439}, {" & & & &南北朝 "," & 420 &— & 589年 "," & &",420,581}, {" & & & &南朝 &"," & 420 &— & 589年 ","建康",420,589}, {" & & & &宋 & &"," & 420 &— & 479年 ","建康",420,479}, {" & & & &齐 & &"," & 479 &— & 502年 ","建康",479,502}, {" & & & &梁 & &"," & 502 &— & 557年 ","建康",502,557}, {" & & & &陈 & &"," & 557 &— & 589年 ","建康",557,589}, {" & & & &北朝 &"," & 386 &— & 581年 "," & &",386,581}, {" & & & &北魏 &"," & 386 &— & 534年 ","平城,洛阳",386,534}, {" & & & &东魏 &"," & 534 &— & 550年 ","邺 &",534,550}, {" & & & &北齐 &"," & 550 &— & 577年 ","邺 &",550,577}, {" & & & &西魏 &"," & 535 &— & 557年 ","长安",535,557}, {" & & & &北周 &"," & 557 &— & 581年 ","长安",557,581}, {" & & & &隋朝 &"," & 581 &— & 618年 ","大兴",581,618}, {" & & & &唐朝 &"," & 618 &— & 907年 ","长安",618,907}, {" & & & &五代十国"," & 907 &— & 979年 "," & &",907,979}, {" & & & &宋朝 &"," & 960 &— &1279年","开封,临安",960,1279}, {" & & & &元朝 &"," & 1206 — &1368年","大都",}, {" & & & &明朝 &"," & 1368 — &1644年","北京",}, {" & & & &清朝 &"," & 1616 — &1911年","北京",}, {" & & & &中华民国"," & 1912 — &1949年","南京",}, {"","","",0,0}, {" & & & &中华人民共和国日成立,首都北京。"," "," ",},};;void display(struct airline *info)/*输出信息执行函数*/{ cout&&info-&chaodai&&" & &\t"&&info-&niandai&&" & &\t"&&info-&ducheng&&" & &\t"&&}void list()/*输出全部信息算法部分*/{ struct airline *&& & int i=0;& & info= //数据链接& & cout&&"\t朝代\t\t\t年代\t\t\t\b都城"&&& & cout&&"\t----\t\t\t----\t\t\t\b----\n"&&& & while(i&MAXSIZE) //逐句输出 {
display(info);
i++; }& & cout&&"\n"&&}int menu_select()/*菜单界面*/{cout&&"\n\t\t\t\t\b历览中国历史朝代"&&cout&&" & & & & & & & & & & & & & & & "&&cout&&"\t\t********************************************"&&cout&&"\t\t* & & & 1.浏览中国历史朝代 & & & & & & & & *"&&cout&&"\t\t* & & & 3.按年代检索朝代信息 & & & & & & & *"&&cout&&"\t\t* & & & 6.查看剩余并排序 & & & & & & & & & *"&&cout&&"\t\t* & & & 0.退出系统 & & & & & & & & & & & & *"&&cout&&"\t\t********************************************"&&do{ cout&&"请选择您需要的操作:"; cin&&c; cout&&"\n"&& // &c=atoi(s);}while(c&0||c&7);}struct airline *find()/*根据年代查询并以指针形式返回*/{ struct airline *int N;// 年代变量int i=0;info= // 数据传递cout&&"请输入查询的年代:"&&cin&&N; // 输入年代cout&&while(i&MAXSIZE)&{ if(N&info-&jieshu)
if(N&info-&qishi) //比较算法
i++;}cout&&"对不起,您输入的年代有误!\n"&&return NULL;}void search()/*根据年代输出信息*/{ struct airline *info,*find();int i=0;info= //数据传递cout&&"请输入要查询的年代:";cin&&cout&&while(i&MAXSIZE)&{ if(niandai&=info-&jieshu)
if(niandai&=info-&qishi)
i++;}if(i&=MAXSIZE){cout&&"对不起,您输入的年代有误!\n\n继续年代查询请输入* &返回主菜单请输入任意键\n"&&cin&&a;if(a=='*')search();}else{ cout&&"\t朝代\t\t\t年代\t\t\t\b都城"&& cout&&"\t----\t\t\t----\t\t\t\b----\n"&& display(info); {cout&&"\n继续年代查询请输入* &返回主菜单请输入任意键\n"&& cin&&a; if(a=='*')search();}}}void main(){& start= for(;;)//进行主菜单选择 {
switch(menu_select())//多分支选择,while循环值
case 1:list(); //表,遍历
case 3:search(); // 查询
// &case 6:sort_tkt(); // 查询剩余并排序
case 0:cout&&"\n谢谢使用,再见!\n"&&exit(0);
cout&&"\n按任意键继续……\n"&&
getch();//按任意键继续
补充:这其中有些代码是没有用的,但是整个程序运行目前是没有问题的。课程设计要求必须有树或者图,麻烦帮忙加一下吧,完全没有思路。
不区分大小写匿名
相关知识等待您来回答
编程领域专家

我要回帖

更多关于 数据结构代码 的文章

 

随机推荐