[计算机类试卷]国家二级C语言机试(操作题)模拟试卷340(无答案).doc

上传人:figureissue185 文档编号:846895 上传时间:2019-02-21 格式:DOC 页数:4 大小:29.50KB
下载 相关 举报
[计算机类试卷]国家二级C语言机试(操作题)模拟试卷340(无答案).doc_第1页
第1页 / 共4页
[计算机类试卷]国家二级C语言机试(操作题)模拟试卷340(无答案).doc_第2页
第2页 / 共4页
[计算机类试卷]国家二级C语言机试(操作题)模拟试卷340(无答案).doc_第3页
第3页 / 共4页
[计算机类试卷]国家二级C语言机试(操作题)模拟试卷340(无答案).doc_第4页
第4页 / 共4页
亲,该文档总共4页,全部预览完了,如果喜欢就下载吧!
资源描述

1、国家二级 C 语言机试(操作题)模拟试卷 340(无答案)一、程序填空题1 给定程序中,函数 fun 的功能是将不带头结点的单向链表逆置。即若原链表中从头至尾结点数据域依次为:2、4、6、8、10,逆置后,从头至尾结点数据域依次为:10、8、6、4、2。请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。注意:源程序存放在考生文件夹下的 BLANK1C 中。不得增行或删行,也不得更改程序的结构!#include #include #define N 5typedef struct node int data;struct node *next; NODE;_1_ fun(NO

2、DE *h)NODE *p,*q,*r;p =h;if (p = NULL)return NULL;q = pnext;pnext = NULL;while (q)r = q_2_ ;qnext = p;p = q;q = _3_ ;return p;NODE *creatlist (int a )NODE *h,*p,*q; int i;h=NULL; q= (NODE *) malloc (sizeof (NODE) ;qdata=a i ;qnext = NULL;if (h = NULL) h= p = q;else pnext = qf p = q; return h;void ou

3、tlist (NODE *h)NODE *p;p=h;if (p=NULL) printf(“The list iselse printf (“nHead “) ;cio printf(“d“,pdata) ; p=pnext; while (p ! =NULL) ;printf ( “Endn“) ;main ()NODE *head;int aN=2,4,6,8,10 ;head=creatlist (a) ;printf ( “ nThe original list: n“) ;outlist (head) ;head=fun (head) ;printf(“nThe list afte

4、rinverting: n“) ;outlist (head) ;二、程序修改题2 给定程序 MODI1C 中函数 fun 的功能是:将 s 所指字符串中位于奇数位置的字符或 ASCII 码为偶数的字符放入 t 所指数组中(规定第一个字符放在第 0 位中)。例如,字符串中的数据为:AABBCCDDEEFF,则输出应当是:ABBCDDEFF 。请改正函数 fun 中指定部位的错误,使它能得出正确的结果。注意:不要改动 maln 函数,不得增行或删行,也不得更改程序的结构!#include #include #define N 80void fun(char *s,char t) int i,j=

5、0;for (i=0; 1void fun(int s 10,int b,int*n,int mm int nn)main ( ) int w10 10= 33,33,33,33 ,44,44,44,44,55 ,55, 55,55Jlri,j;int a100=0,n=0;voidNONO ();printf (“The matrix:n“) ; for (j=0; j4 ; j+) printf ( “3d“,printf(“The A array:n“);for (i=0; in ; i+) printf ( “ 3d“ ,void NONO () /*请在此函数内打开文件,输入测试数据

6、,调用 fun 函数,输出数据,关闭文件。 */FILE *rf,*wf ; int i,j,k ;int w10 10 ,a 100 ,n=0,mm,nn;rf = fopen (“indat“ ,“r“) ;wf = fopen (“outdat“ “w“) ;fscanf (rf,“ d d“, &mm, &nn) ;for(i = 0 ; i mm ; i+)for(j = 0; j nn f j+) fscanffun(w,a,&n,nun,nn);for(i = 0 ; i n ; i+) fprintf(wf,“ 3d“,a i ) ; fprintf (wf,“ n“) ;fclose (rf) ; fclose (wf) ;

展开阅读全文
相关资源
猜你喜欢
  • EN 12311-2-2013 en Flexible sheets for waterproofing - Determination of tensile properties - Part 2 Plastic and rubber sheets for roof waterproofing《防水用柔性薄板 拉伸性能的测定 第2部分 屋顶防水用塑料和橡胶.pdf EN 12311-2-2013 en Flexible sheets for waterproofing - Determination of tensile properties - Part 2 Plastic and rubber sheets for roof waterproofing《防水用柔性薄板 拉伸性能的测定 第2部分 屋顶防水用塑料和橡胶.pdf
  • EN 12312-1-2013 en Aircraft ground support equipment - Specific requirements - Part 1 Passenger stairs《飞机地面支持设备 具体要求 第1部分 乘客楼梯》.pdf EN 12312-1-2013 en Aircraft ground support equipment - Specific requirements - Part 1 Passenger stairs《飞机地面支持设备 具体要求 第1部分 乘客楼梯》.pdf
  • EN 12312-10-2005 en Aircraft ground support equipment - Specific requirements - Part 10 Container Pallet transfer transporters (Incorporates Amendment A1 2009)《航空地面辅助设备 特殊要求 第10部分 .pdf EN 12312-10-2005 en Aircraft ground support equipment - Specific requirements - Part 10 Container Pallet transfer transporters (Incorporates Amendment A1 2009)《航空地面辅助设备 特殊要求 第10部分 .pdf
  • EN 12312-11-2005 en Aircraft Ground Support Equipment - Specific Requirements - Part 11 Container Pallet Dollies and Loose Load Trailers《航空地面辅助设备 特殊要求 第11部分 容器 集装箱推车和可拆卸载重拖车》.pdf EN 12312-11-2005 en Aircraft Ground Support Equipment - Specific Requirements - Part 11 Container Pallet Dollies and Loose Load Trailers《航空地面辅助设备 特殊要求 第11部分 容器 集装箱推车和可拆卸载重拖车》.pdf
  • EN 12312-12-2002 en Aircraft ground support equipment - Specific requirements - Part 12 Potable water service equipment (Incorporates Amendment A1 2009)《航空地面辅助设备 特殊要求 第12部分 饮用水服务设施.pdf EN 12312-12-2002 en Aircraft ground support equipment - Specific requirements - Part 12 Potable water service equipment (Incorporates Amendment A1 2009)《航空地面辅助设备 特殊要求 第12部分 饮用水服务设施.pdf
  • EN 12312-12-2017 en Aircraft ground support equipment - Specific requirements - Part 12 Potable water service equipment.pdf EN 12312-12-2017 en Aircraft ground support equipment - Specific requirements - Part 12 Potable water service equipment.pdf
  • EN 12312-13-2002 5000 Aircraft ground support equipment - Specific requirements - Part 13 Lavatory service equipment (Incorporates Amendment A1 2009)《航空地面辅助设备 特殊要求 第13部分 洗浴室服务设施 包含.pdf EN 12312-13-2002 5000 Aircraft ground support equipment - Specific requirements - Part 13 Lavatory service equipment (Incorporates Amendment A1 2009)《航空地面辅助设备 特殊要求 第13部分 洗浴室服务设施 包含.pdf
  • EN 12312-13-2017 en Aircraft ground support equipment - Specific requirements - Part 13 Lavatory service equipment.pdf EN 12312-13-2017 en Aircraft ground support equipment - Specific requirements - Part 13 Lavatory service equipment.pdf
  • EN 12312-14-2014 en Aircraft ground support equipment - Specific requirements - Part 14 Disabled incapacitated passenger boarding vehicles《航空器地勤支援设备 具体要求 第14部分 残疾 丧失行动能力乘客登机车辆》.pdf EN 12312-14-2014 en Aircraft ground support equipment - Specific requirements - Part 14 Disabled incapacitated passenger boarding vehicles《航空器地勤支援设备 具体要求 第14部分 残疾 丧失行动能力乘客登机车辆》.pdf
  • 相关搜索
    资源标签

    当前位置:首页 > 考试资料 > 职业资格

    copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
    备案/许可证编号:苏ICP备17064731号-1