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

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

1、国家二级 C 语言机试(操作题)模拟试卷 367(无答案)一、程序填空题1 给定程序中已建立一个带有头结点的单向链表,链表中的各结点按数据域递增有序链接。函数 fun 的功能是:删除链表中数据域值相同的结点,使之只保留一个。请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。注意:源程序存放在考生文件夹下的 BLANK1C 中。不得增行或删行,也不得更改程序的结构!#include #include #define N 8typedef struct list int data;struct list *next; SLIST;void fun (SLIST *h)SLIST

2、 *p,*q;p=hnext ;if (p ! =NULL) q=p 一next;while (q ! =NULL) if (pdata=qdata) pnext=qnext;/*found*/ free (_1_ ) ;/*found*/ q=p_2_ ; elsep=q;/*found*/ q=q _3_ ;SLIST *creatlist (int *a)SLIST *h,*p,*q; int i;h=p= (SLIST *) malloc (sizeof (SLIST) ; q=(SLIST *) malloc (sizeof (SLIST) ;qdata=a i ; p next=q

3、 p=q ;pnext=0 ;return h;void outlist (SLIST *h)SLIST *p;p=hnext;if (p=NULL) printf(“nThe listis NULL ! n“) ;else printf (“nHead“) ;clo printf (“d“ ,pdata) ;p=pnext; while (p ! =NULL) ;printf (“Endn“) ;main ()SLIST *head; int a INl=l,2,2,3,4,4,4,5 ;head=creatlist (a) ;printf(“nThe list before deleti

4、ng:n“) ; outlist (head) ;fun (head) ;printf(“nThe list after deleting:n“) ; outlist (head) ;二、程序修改题2 给定程序 MODI1C 中函数 fun 的功能是:用选择法对数组中的 n 个元素按从小到大的顺序进行排序。请修改程序中的错误,使它能得出正确的结果。注意:不要改动 mam 函数,不得增行和删行,也不得更改程序的结构!#include #define N 20void fun(int a,int n) int i,j,t,p;for (j = 0 ;j #define M 100void fun

5、int m int *a , int *n)main()int aa M, n k;void NONO ();fun (50, aa, &n);for (k= 0; kn ; k+)if(k+1) 0020=0) printf(“n“);else printf(“4d“, aa k) ;printf(“n“);NONO();void NONO ()/*本函数用于打开文件,输入数据,调用函数,输出数据,关闭文件。 */FILE *fp,*wf ;int i, n, j, k, aaM,sum ;fp=fopen (“indat“,“r“);wf=fopen(“outdat“,“w“);for(i= 0 ; i 10 ; i+) fscanf( fpf “d,“,&j);fun (j, aa, &n);sum =0 ;for(k=0 ; kn ; k+) sum+=aa k ;fprintf (wf, “dn“, sum);fclose( fp);fclose (wf);

展开阅读全文
相关资源
猜你喜欢
  • DIN 85005-38-1999 Ships and marine technology - Graphical symbols for technical documentation - Part 38 Devices of electrical installations in special systems《船舶和航海技术 技术文献的图形符号 第38.pdf DIN 85005-38-1999 Ships and marine technology - Graphical symbols for technical documentation - Part 38 Devices of electrical installations in special systems《船舶和航海技术 技术文献的图形符号 第38.pdf
  • DIN 85005-4-2012 Ships and marine technology - Graphical symbols for technical documentation - Part 4 Sounding pipes air pipes and filling pipes Text in German and English《船舶和海洋技术 .pdf DIN 85005-4-2012 Ships and marine technology - Graphical symbols for technical documentation - Part 4 Sounding pipes air pipes and filling pipes Text in German and English《船舶和海洋技术 .pdf
  • DIN 85005-5-1998 Ships and marine technology - Graphical symbols for technical documentation - Part 5 Steam generator heat exchanger container《船舶和海上技术 技术文献的图形符号 第5部分 蒸气发生器、热交换器和容器》.pdf DIN 85005-5-1998 Ships and marine technology - Graphical symbols for technical documentation - Part 5 Steam generator heat exchanger container《船舶和海上技术 技术文献的图形符号 第5部分 蒸气发生器、热交换器和容器》.pdf
  • DIN 85005-6-1998 Ships and marine technology - Graphical symbols for technical documentation - Part 6 Freshwater distilling unit《船舶和海上技术 技术文献的图形符号 第6部分 淡水蒸馏装置》.pdf DIN 85005-6-1998 Ships and marine technology - Graphical symbols for technical documentation - Part 6 Freshwater distilling unit《船舶和海上技术 技术文献的图形符号 第6部分 淡水蒸馏装置》.pdf
  • DIN 85005-7-1999 Ships and marine technology - Graphical symbols for technical documentation - Part 7 Pressure tanks《船舶和航海技术 技术文献的图形符号 第7部分 压力液体舱》.pdf DIN 85005-7-1999 Ships and marine technology - Graphical symbols for technical documentation - Part 7 Pressure tanks《船舶和航海技术 技术文献的图形符号 第7部分 压力液体舱》.pdf
  • DIN 85005-8-2001 Ships and marine technology - Graphical symbols for technical documentation - Part 8 Power transmission plant and steering gear components《船舶和船舶技术 技术文献图形符号 第8部分 动力.pdf DIN 85005-8-2001 Ships and marine technology - Graphical symbols for technical documentation - Part 8 Power transmission plant and steering gear components《船舶和船舶技术 技术文献图形符号 第8部分 动力.pdf
  • DIN 85005-9-1999 Ships and marine technology - Graphical symbols for technical documentation - Part 9 Suction- and discharge sockets《船舶和航海技术 技术文献的图形符号 第9部分 吸入和排放管的管座》.pdf DIN 85005-9-1999 Ships and marine technology - Graphical symbols for technical documentation - Part 9 Suction- and discharge sockets《船舶和航海技术 技术文献的图形符号 第9部分 吸入和排放管的管座》.pdf
  • DIN 85031-2014 Ships and marine technology - Steel expansion joints《船舶与海洋技术 钢制扩展伸缩接头》.pdf DIN 85031-2014 Ships and marine technology - Steel expansion joints《船舶与海洋技术 钢制扩展伸缩接头》.pdf
  • DIN 85051-1-2012 Pressfitting systems for pipes for use in shipbuilding - General requirements and test methods - Part 1 Operating pressures up to 16 bar《造船用管道压装系统 通用要求和试验方法 第1部分 1.pdf DIN 85051-1-2012 Pressfitting systems for pipes for use in shipbuilding - General requirements and test methods - Part 1 Operating pressures up to 16 bar《造船用管道压装系统 通用要求和试验方法 第1部分 1.pdf
  • 相关搜索

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

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