[计算机类试卷]国家二级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 65236-1988 Aerospace steel nickel- and cobalt-alloy wire technical specification《航空航天 钢丝 镍和钴合金丝材 技术规范》.pdf DIN 65236-1988 Aerospace steel nickel- and cobalt-alloy wire technical specification《航空航天 钢丝 镍和钴合金丝材 技术规范》.pdf
  • DIN 65237-1996 Aerospace - Spherical plain bearings steel on steel - Technical specification inactive for new design《航空航天 双层钢活塞节轴承 交货技术条件 对新设计无效》.pdf DIN 65237-1996 Aerospace - Spherical plain bearings steel on steel - Technical specification inactive for new design《航空航天 双层钢活塞节轴承 交货技术条件 对新设计无效》.pdf
  • DIN 65238-2002 Aerospace - Anchor nuts with MJ thread deep counterbore self-locking non-floating corner steel Classification 1100 MPa 235 C《航空航天 自锁非浮动钢制角缘带MJ螺纹深埋头锚定螺母 分类 1100MPa 23.pdf DIN 65238-2002 Aerospace - Anchor nuts with MJ thread deep counterbore self-locking non-floating corner steel Classification 1100 MPa 235 C《航空航天 自锁非浮动钢制角缘带MJ螺纹深埋头锚定螺母 分类 1100MPa 23.pdf
  • DIN 65239-2006 Aerospace - Anchor nuts with MJ thread deep counterbore self-locking non-floating corner corrosion-resisting steel classification 1100 MPa 315 C 425 C《航空航天 深沉孔、不浮动、带.pdf DIN 65239-2006 Aerospace - Anchor nuts with MJ thread deep counterbore self-locking non-floating corner corrosion-resisting steel classification 1100 MPa 315 C 425 C《航空航天 深沉孔、不浮动、带.pdf
  • DIN 65240-2002 Aerospace - Anchor nuts with MJ thread deep counterbore self-locking floating two lug steel Classification 1100 MPa 235 C《航空航天 自锁浮动钢制双耳带MJ螺纹深埋头锚定螺母 分类 1100MPa 235℃》.pdf DIN 65240-2002 Aerospace - Anchor nuts with MJ thread deep counterbore self-locking floating two lug steel Classification 1100 MPa 235 C《航空航天 自锁浮动钢制双耳带MJ螺纹深埋头锚定螺母 分类 1100MPa 235℃》.pdf
  • DIN 65242-2015 Aerospace - Anchor nuts with MJ-thread deep counterbore self-locking floating two lug corrosion-resisting steel classification 1 100 MPa 315 C 425 C Text in German a.pdf DIN 65242-2015 Aerospace - Anchor nuts with MJ-thread deep counterbore self-locking floating two lug corrosion-resisting steel classification 1 100 MPa 315 C 425 C Text in German a.pdf
  • DIN 65243-2002 Aerospace - Anchor nuts with MJ thread deep counterbore self-locking floating single lug steel Classification 1100 MPa 235 C《航空航天 单耳浮动自锁深埋头带MJ螺纹的钢制锚定螺母 分类 1100MPa 23.pdf DIN 65243-2002 Aerospace - Anchor nuts with MJ thread deep counterbore self-locking floating single lug steel Classification 1100 MPa 235 C《航空航天 单耳浮动自锁深埋头带MJ螺纹的钢制锚定螺母 分类 1100MPa 23.pdf
  • DIN 65244-2015 Aerospace - Anchor nuts with MJ thread deep counterbore self-locking floating single lug corrosion-resisting steel classification 1 100 MPa 315 C 425 C Text in Germa.pdf DIN 65244-2015 Aerospace - Anchor nuts with MJ thread deep counterbore self-locking floating single lug corrosion-resisting steel classification 1 100 MPa 315 C 425 C Text in Germa.pdf
  • DIN 65245-1984 Aerospace nuts hexagon with MJ-thread self-locking in steel classification 1100 MPa 120 C《航空和航天 钢制、带MJ螺纹的六角自锁螺母 等级 1100MPa 120℃》.pdf DIN 65245-1984 Aerospace nuts hexagon with MJ-thread self-locking in steel classification 1100 MPa 120 C《航空和航天 钢制、带MJ螺纹的六角自锁螺母 等级 1100MPa 120℃》.pdf
  • 相关搜索

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

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