计算机二级c语言考试上级题库答案

计算机二级c语言考试上级题库答案

ID:33585960

大小:424.00 KB

页数:214页

时间:2019-02-27

计算机二级c语言考试上级题库答案_第1页
计算机二级c语言考试上级题库答案_第2页
计算机二级c语言考试上级题库答案_第3页
计算机二级c语言考试上级题库答案_第4页
计算机二级c语言考试上级题库答案_第5页
资源描述:

《计算机二级c语言考试上级题库答案》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、#include#include#defineN8typedefstructlist{intdata;structlist*next;}SLIST;voidfun(SLIST*p){SLIST*t,*s;t=p->next;s=p;while(t->next!=NULL){s=t;/**********found**********/t=t->next;}/**********found**********/printf("%d",t->data);s->next

2、=NULL;/**********found**********/free(t);}SLIST*creatlist(int*a){SLIST*h,*p,*q;inti;h=p=(SLIST*)malloc(sizeof(SLIST));for(i=0;idata=a[i];p->next=q;p=q;}p->next=0;returnh;}voidoutlist(SLIST*h){SLIST*p;p=h->next;

3、if(p==NULL)printf("ThelistisNULL!");else{printf("Head");do{printf("->%d",p->data);p=p->next;}while(p!=NULL);printf("->End");}}main(){SLIST*head;inta[N]={11,12,15,18,19,22,25,29};head=creatlist(a);printf("Outputfromhead:");outlist(head);print

4、f("Outputfromtail:");while(head->next!=NULL){fun(head);printf("");printf("Outputfromheadagain:");outlist(head);}}#include/************found************/fun(char*a){if(*a){fun(a+1);/************found************/printf("%c",*a);}}mai

5、n(){chars[10]="abcd";printf("处理前字符串=%s处理后字符串=",s);fun(s);printf("");}#includechar*fun(char*s,char*t){inti;char*p=s,*q=t;for(i=0;*p&&*q;i++){p++;q++;}if(*p==0&&*q==0)returns;if(*p)returns;elsereturnt;}main(){chara[20],b[20];printf("Input1ths

6、tring:");gets(a);printf("Input2thstring:");gets(b);printf("%s",fun(a,b));NONO();}NONO(){/*本函数用于打开文件,输入数据,调用函数,输出数据,关闭文件。*/FILE*fp,*wf;inti;chara[20],b[20];fp=fopen("C:\WEXAM\24990001\in.dat","r");wf=fopen("C:\WEXAM\24990001\out.dat","w");for(i=0

7、;i<10;i++){fscanf(fp,"%s%s",a,b);fprintf(wf,"%s",fun(a,b));}fclose(fp);fclose(wf);}#include#include#defineN8typedefstructlist{intdata;structlist*next;}SLIST;voidfun(SLIST*h){SLIST*p,*q;p=h->next;if(p!=NULL){q=p->next;while(q!=NULL){

8、if(p->data==q->data){p->next=q->next;/**********found**********/free(q);/**********found**********/q=p->next;}else{p=q;/**********found**********/q=q->next;}}}}SLIST*creatlist(int*a){SLIST*h,*p,*q;inti;h=p=(SLIST*)malloc(sizeof(S

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。