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

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

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

2、T;void fun (SLIST *h, irit X)SLIST *p,*q,*s;s= (SLIST *) malloc (sizeof (SLIST) ;sdata= _1_ ;q=h;p=h next;while (p ! =NULL & xpdata) q=_2_;p=pnext;snext=p;qnext=_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 ;

3、 p next=q; 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“) ;do printf (“ d“ f pdata) ;p=pnext; while (p ! =NULL) ;printf ( “Endn“) ;main SLIST *head; int x;int a N = 11,12,15,18 f 19,22,25, 29;head=creatlist (a) ;printf

4、 ( “nThe list before inserting:n“) ; outlist (head) ;printf(“nEnter a number : “);fun (headf x) ;printf (“nThe list after inserting:n“) ; outlist (head) ;二、程序修改题2 给定程序 MODI1C 中函数 fun 的功能是:计算正整数 num 的各位上的数字之积。例如,若输入:252,则输出应该是:20。若输入:202,则输出应该是:0。请改正程序中的错误,使它能得出正确的结果。注意:不要改动 maln 函数,不得增行或删行,也不得更改程序的结

5、构!#include long fun (long num)long k;do k*=numool0 ;num=10 ; while (num) ;return (k) ;main ( ) long n ;printf (“nPlease enter a number:“) ;scanf ( “1d“,&n) ;三、程序设计题3 请编写一个函数 fun,它的功能是:计算 n 门课程的平均分,计算结果作为函数值返回。例如:若有 5 门课程的成绩是:905,72,80,615,55。则函数的值为:7180。注意:部分源程序存在文件 PROG1C 中。请勿改动主函数 maln 和其他函数中的任何内容

6、,仅在函数 fun 的花括号中填入你编写的若干语句。#include float fun (float *a , int n)main()float score301=905, 72,80,615,55) ,aver ;void NONO ();aver=fun (score, 5);printf (“nAverage score is:52fn“,aver);NONO ();void NONO ()/*本函数用于打开文件,输入数据,调用函数,输出数据,关闭文件。 */FILE *fpf *wf ;int i,j ;float aver, score 5 ;fp=fopen(“indat“,“r“);wf = fopen (“outdat“ ,“w“);for(i=0 ; i 10 ; i+) for(j =0 ; j 5 ; j+) fscanf(fp,“f ,“,&scorej) ;aver = fun (score, 5);fprintf (wf, “52fn“,aver);fclose( fp);fclose (wf);

展开阅读全文
相关资源
猜你喜欢
  • BS 6043-1 10-2000 Methods of sampling and test for carbonaceous materials used in aluminium manufacture - Electrode pitch - Determination of volatile matter content - Section 1 10 .pdf BS 6043-1 10-2000 Methods of sampling and test for carbonaceous materials used in aluminium manufacture - Electrode pitch - Determination of volatile matter content - Section 1 10 .pdf
  • BS 6043-1 11-2000 Methods of sampling and test for carbonaceous materials used in aluminium manufacture - Determination of the atomic C H ratio of the quinoline-insoluble material《.pdf BS 6043-1 11-2000 Methods of sampling and test for carbonaceous materials used in aluminium manufacture - Determination of the atomic C H ratio of the quinoline-insoluble material《.pdf
  • BS 6043-1 12-1994 Method of sampling and test for carbonaceous materials used in aluminium manufacture - Electrode pitch - Determination of mesophase content《制铝工业用炭素材料取样与试验方法 第1部分 .pdf BS 6043-1 12-1994 Method of sampling and test for carbonaceous materials used in aluminium manufacture - Electrode pitch - Determination of mesophase content《制铝工业用炭素材料取样与试验方法 第1部分 .pdf
  • BS 6043-1 13-2000 Methods of sampling and test for carbonaceous materials used in aluminium manufacture - Electrode pitch - Determination of sulfur content《制铝工业用含碳材料的取样和试验方法 电极用沥青 .pdf BS 6043-1 13-2000 Methods of sampling and test for carbonaceous materials used in aluminium manufacture - Electrode pitch - Determination of sulfur content《制铝工业用含碳材料的取样和试验方法 电极用沥青 .pdf
  • BS 6043-1 2-1981 Methods of sampling and test for carbonaceous materials used in aluminium manufacture - Electrode pitch - Determination of water content (Dean and Stark method)《制铝.pdf BS 6043-1 2-1981 Methods of sampling and test for carbonaceous materials used in aluminium manufacture - Electrode pitch - Determination of water content (Dean and Stark method)《制铝.pdf
  • BS 6043-1 3-1983 Methods of sampling and test for carbonaceous materials used in aluminium manufacture - Electrode pitch - Determination of softening point (ring and ball method)《制.pdf BS 6043-1 3-1983 Methods of sampling and test for carbonaceous materials used in aluminium manufacture - Electrode pitch - Determination of softening point (ring and ball method)《制.pdf
  • BS 6043-1 4-1981 Methods of sampling and test for carbonaceous materials used in aluminium manufacture - Electrode pitch - Determination of content of toluene-insoluble material《制铝.pdf BS 6043-1 4-1981 Methods of sampling and test for carbonaceous materials used in aluminium manufacture - Electrode pitch - Determination of content of toluene-insoluble material《制铝.pdf
  • BS 6043-1 5-1983 Methods of sampling and test for carbonaceous materials used in aluminium manufacture - Electrode pitch - Determination of content of quinoline-insoluble material《.pdf BS 6043-1 5-1983 Methods of sampling and test for carbonaceous materials used in aluminium manufacture - Electrode pitch - Determination of content of quinoline-insoluble material《.pdf
  • BS 6043-1 6-1998 Methods of sampling and test for carbonaceous materials used in aluminium manufacture - Electrode pitch - Determination of coking value - Section 1 6 Determination.pdf BS 6043-1 6-1998 Methods of sampling and test for carbonaceous materials used in aluminium manufacture - Electrode pitch - Determination of coking value - Section 1 6 Determination.pdf
  • 相关搜索
    资源标签

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

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