[计算机类试卷]国家二级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);

展开阅读全文
相关资源
猜你喜欢
  • DIN EN 62024-2-2009 High frequency inductive components - Electrical characteristics and measuring methods - Part 2 Rated current of inductors for DC to DC converters (IEC 62024-2 .pdf DIN EN 62024-2-2009 High frequency inductive components - Electrical characteristics and measuring methods - Part 2 Rated current of inductors for DC to DC converters (IEC 62024-2 .pdf
  • DIN EN 62025-1-2008 High frequency inductive components - Non-electrical characteristics and measuring methods - Part 1 Fixed surface mounted inductor for use in electronic and tel.pdf DIN EN 62025-1-2008 High frequency inductive components - Non-electrical characteristics and measuring methods - Part 1 Fixed surface mounted inductor for use in electronic and tel.pdf
  • DIN EN 62025-2-2005 High frequency inductive components - Non-electrical characteristics and measuring methods - Part 2 Test methods for non-electrical characteristics (IEC 62025-2.pdf DIN EN 62025-2-2005 High frequency inductive components - Non-electrical characteristics and measuring methods - Part 2 Test methods for non-electrical characteristics (IEC 62025-2.pdf
  • DIN EN 62026-1-2008 Low-voltage switchgear and controlgear - Controller-device interfaces (CDIs) - Part 1 General rules (IEC 62026-1 2007) German version EN 62026-1 2007《低压开关装置和控制器.pdf DIN EN 62026-1-2008 Low-voltage switchgear and controlgear - Controller-device interfaces (CDIs) - Part 1 General rules (IEC 62026-1 2007) German version EN 62026-1 2007《低压开关装置和控制器.pdf
  • DIN EN 62027-2012 Preparation of object lists including parts lists (IEC 62027 2011) German version EN 62027 2012《零部件清单的编制 包括零件清单(IEC 62027-2011) 德文版本EN 62027-2012》.pdf DIN EN 62027-2012 Preparation of object lists including parts lists (IEC 62027 2011) German version EN 62027 2012《零部件清单的编制 包括零件清单(IEC 62027-2011) 德文版本EN 62027-2012》.pdf
  • DIN EN 62028-2004 General methods of measurement for digital television receivers (IEC 62028 2002) German version EN 62028 2004《数字电视接收器测量的一般方法》.pdf DIN EN 62028-2004 General methods of measurement for digital television receivers (IEC 62028 2002) German version EN 62028 2004《数字电视接收器测量的一般方法》.pdf
  • DIN EN 62034-2013 Automatic test systems for battery powered emergency escape lighting (IEC 62034 2012) German version EN 62034 2012《电池供电的应急疏散照明的自动试验系统(IEC 62034-2012) 德文版本EN 62034.pdf DIN EN 62034-2013 Automatic test systems for battery powered emergency escape lighting (IEC 62034 2012) German version EN 62034 2012《电池供电的应急疏散照明的自动试验系统(IEC 62034-2012) 德文版本EN 62034.pdf
  • DIN EN 62037-1-2013 Passive RF and microwave devices intermodulation level measurement - Part 1 General requirements and measuring methods (IEC 62037-1 2012) German version EN 6203.pdf DIN EN 62037-1-2013 Passive RF and microwave devices intermodulation level measurement - Part 1 General requirements and measuring methods (IEC 62037-1 2012) German version EN 6203.pdf
  • DIN EN 62037-2-2013 Passive RF and microwave devices intermodulation level measurement - Part 2 Measurement of passive intermodulation in coaxial cable assemblies (IEC 62037-2 2012.pdf DIN EN 62037-2-2013 Passive RF and microwave devices intermodulation level measurement - Part 2 Measurement of passive intermodulation in coaxial cable assemblies (IEC 62037-2 2012.pdf
  • 相关搜索
    资源标签

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

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