全国计算机二级C语言上机100题..doc

  1. 1、本文档共203页,可阅读全部内容。
  2. 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
上 机 题 库 第一部分 填空题 ????????????????????????????????????????????????????????????? 注意:源程序存放在考生文件夹下的BLANK1.C中。 不得增行或删行,也不得更改程序的结构! 请在程序下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。 ????????????????????????????????????????????????????????????? 给定程序中,函数FUN的功能是:计算出带有头接点的单向链表中各结点数据域之和作为函数值返回。 #include stdio.h #include stdlib.h #define N 8 typedef struct list { int data; struct list *next; } SLIST; SLIST *creatlist(int *); void outlist(SLIST *); int fun( SLIST *h) { SLIST *p; int s=0; p=h-next; while(p) { /**********************************found*********************************/ s+= p-___1___; data /**********************************found*********************************/ p=p-___2___; next } return s; } main( ) { SLIST *head; int a[N]={12,87,45,32,91,16,20,48}; head=creatlist(a); outlist(head); /**********************************found*********************************/ printf(\nsum=%d\n, fun(___3___)); head } SLIST *creatlist(int a[ ]) { SLIST *h,*p,*q; int i; h=p=(SLIST *)malloc(sizeof(SLIST)); for(i=0; iN; i++) { q=(SLIST *)malloc(sizeof(SLIST)); q-data=a[i]; p-next=q; p=q; } p-next=0; return h; } void outlist(SLIST *h) { SLIST *p; p=h-next; if (p==NULL) printf(The list is NULL!\n); else { printf(\nHead ); do { printf(-%d, p-data); p=p-next; } while(p!=NULL); printf(-End\n); } } 给定程序中,函数FUN的功能是:求出形参SS所指字符串数组中最长字符串的长度,其余字符串左边用字符*补齐,使其与最长的字符串等长。字符串数组中工有M个字符串,且串长N。 #include stdio.h #include string.h #define M 5 #define N 20 void fun(char (*ss)[N]) { int i, j, k=0, n, m, len; for(i=0; iM; i++) { len=strlen(ss[i]); if(i==0) n=len; if(lenn) { /**********************************found*********************************/ n=len; k=___1___; i } } for(i=0; iM; i++)

文档评论(0)

yxnz + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档