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

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

1、国家二级 C 语言机试(操作题)模拟试卷 347(无答案)一、程序填空题1 函数 fun 的功能是进行数字字符转换。若形参 ch 中是数字字符09,则0转换成9 , 1转换成 8,2转换成 7,9转换成0;若是其他字符则保持不变:并将转换后的结果作为函数值返回。请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。注意:源程序存放在考生文件夹下的 BLANK1C 中。不得增行或删行,也不得更改程序的结构!#include _1_ fun (char ch)return 9 (ch _3_) ;return ch ;main () char c1/ c2;printf (“nTh

2、e result :n“) ;c1=2; c2 = fun (c1) ;printf (“c1=C c2=cn“ ,c1,c2) ;cl=8; c2 = fun (cl) ;printf (“cl= c2= c n “ , c1, c2) ;c1=a; c2 = fun (c1) ;printf (“c1=c c2=ooCn“,c1,c2) ;二、程序修改题2 给定程序 MODI1C 中函数 fun 的功能是:将 p 所指字符串中的所有字符复制到 b 中,要求每复制三个字符之后插入一个空格。例如,在调用 fun 函数之前给 a 输入字符串:ABCDEFGHIJK,调用函数之后,字符数组 b 中

3、的内容则为:ABC DEF GHI JK。请改正程序中的错误,使它能得出正确结果。注意:不要改动 main 函数,不得增行或删行,也不得更改程序的结构。#include void fun(char *p,char *b) int i,k=0;while ( *p)b k =p;k+;p+ ;i+;if(*p)/*found*/bk+=“ “;main () char a80,b80;printf (“Enter a string:“) ; gets (a) ;printf (“The original string: “) ;puts (a) ;fun (a,b) ;printf ( “nTh

4、e string after insertspace: “) ; puts (b) ; printf (“nn“) ;三、程序设计题3 N 名学生的成绩已在主函数中放入一个带头节点的链表结构中, h 指向链表的头节点。请编写函数 fun,它的功能是:求出平均分,由函数值返回。例如,若学生的成绩是:85,76,69,85,91,72,64,87,则平均分应当是:78625。注意:部分源程序在文件 PROG1C 中。请勿改动主函数 mam 和其他函数中的任何内容,仅在函数 fun 的花括号中填入你编写的若干语句。#include #include #define N 8struct slist d

5、ouble s;struct slist *next;typedef struct slist STREC;double fun (STREC *h)STREC * creat (double *s)STREC *h, *p,*q; int i=0 ;h=p= (STREC*) malloc ( sizeof (STREC);ps=0;while (is=si; i+; pnext=q; p=q;pnext=0;return h;outlist(STREC *h)STREC *p;p=hnext; printf ( “head“) ;doprintf(“0041f“ ,p 一 s);p=p n

6、ext ;)while(p!=0);printf(“nn“);main()double sN= 85,76,69,85,91,72,64,87) ,ave ;void NONO ();STREC *h;h=creat (s); outlist (h) ;ave=fun (h);printf (“ave= 63fn“,ave);NONO();void NONO()/*本函数用于打开文件,输入数据,调用函数,输出数据,关闭文件。 */FILE *in,*out ;int i,j ; double sN ,ave ;STREC *h;in=fopen (“indat“,“r“) ;out=fopen (“outdat“,“w“) ;for(i=0 ; i 10 ; i+) for(j=0;jN; j+) fscanf(in,“ 1f, “,sj);h=creat (s);ave=fun (h);fprintf (outt “631fn“,ave) ;fclose (in);fclose (out);

展开阅读全文
相关资源
猜你喜欢
  • DIN 25405-1970 Aspects of a safe design of thermal reactors with regard to their reactivity behaviour《与反应特性有关的热反应堆的安全设计观念》.pdf DIN 25405-1970 Aspects of a safe design of thermal reactors with regard to their reactivity behaviour《与反应特性有关的热反应堆的安全设计观念》.pdf
  • DIN 25407 Bb 1-2012 Shielding walls against ionizing radiation - Supplement 1 Recommendations for the construction of walls made of bricks《防电离放射屏蔽墙 补充件1 铅制砖墙构筑的推荐规范》.pdf DIN 25407 Bb 1-2012 Shielding walls against ionizing radiation - Supplement 1 Recommendations for the construction of walls made of bricks《防电离放射屏蔽墙 补充件1 铅制砖墙构筑的推荐规范》.pdf
  • DIN 25407-1-2011 Shielding walls against ionizing radiation - Part 1 Bricks《防电离辐射的屏蔽墙 第1部分 砖块》.pdf DIN 25407-1-2011 Shielding walls against ionizing radiation - Part 1 Bricks《防电离辐射的屏蔽墙 第1部分 砖块》.pdf
  • DIN 25407-2-2011 Shielding walls against ionizing radiation - Part 2 Special construction elements for lead shielding walls《防电离辐射的屏蔽墙 第2部分 铅屏蔽墙用特殊构件》.pdf DIN 25407-2-2011 Shielding walls against ionizing radiation - Part 2 Special construction elements for lead shielding walls《防电离辐射的屏蔽墙 第2部分 铅屏蔽墙用特殊构件》.pdf
  • DIN 25407-3-2012 Shielding walls against ionizing radiation - Part 3 Construction of lead hot cells《防电离辐射的屏蔽墙 第3部分 铅热室结构》.pdf DIN 25407-3-2012 Shielding walls against ionizing radiation - Part 3 Construction of lead hot cells《防电离辐射的屏蔽墙 第3部分 铅热室结构》.pdf
  • DIN 25409 Bb 1-2015 Remote handling devices for use behind shielding walls Supplement 1 Recommendations for use《在护壁后面使用的遥控操作装置 补充1 使用推荐说明》.pdf DIN 25409 Bb 1-2015 Remote handling devices for use behind shielding walls Supplement 1 Recommendations for use《在护壁后面使用的遥控操作装置 补充1 使用推荐说明》.pdf
  • DIN 25409-1-2015 Remote handling devices for use behind shielding walls - Part 1 Remote handling tongs - Dimensions《屏蔽墙后面用遥控搬运装置 第1部分 遥控搬运抓手 尺寸》.pdf DIN 25409-1-2015 Remote handling devices for use behind shielding walls - Part 1 Remote handling tongs - Dimensions《屏蔽墙后面用遥控搬运装置 第1部分 遥控搬运抓手 尺寸》.pdf
  • DIN 25409-2-2015 Remote handling devices for use behind shielding walls - Part 2 Master-slave manipulators with three pivots - Dimensions《屏蔽墙后面用遥控搬运装置 第2部分 带三个枢轴仿效机械手 尺寸》.pdf DIN 25409-2-2015 Remote handling devices for use behind shielding walls - Part 2 Master-slave manipulators with three pivots - Dimensions《屏蔽墙后面用遥控搬运装置 第2部分 带三个枢轴仿效机械手 尺寸》.pdf
  • DIN 25409-3-2015 Remote handling devices for use behind shielding walls - Part 3 Telescopic master slave manipulators - Dimensions《屏蔽墙后面用遥控搬运装置 第3部分 伸缩式仿效机械手 尺寸》.pdf DIN 25409-3-2015 Remote handling devices for use behind shielding walls - Part 3 Telescopic master slave manipulators - Dimensions《屏蔽墙后面用遥控搬运装置 第3部分 伸缩式仿效机械手 尺寸》.pdf
  • 相关搜索
    资源标签

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

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