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

展开阅读全文
相关资源
猜你喜欢
  • AGMA 06FTM07-2006 Improvement of Standardized Test Methods for Evaluating the Lubricant Influence on Micropitting and Pitting Resistance of Case Carburized Gears《评估润滑剂对层渗碳齿轮上微点蚀和抗点.pdf AGMA 06FTM07-2006 Improvement of Standardized Test Methods for Evaluating the Lubricant Influence on Micropitting and Pitting Resistance of Case Carburized Gears《评估润滑剂对层渗碳齿轮上微点蚀和抗点.pdf
  • AGMA 06FTM08-2006 An Evaluation of FZG Micropitting Test Procedures and Results for the Crowned AGMA Test Gears《鼓形AGMA测试齿轮用FZG微点蚀测试程序和结果的评估》.pdf AGMA 06FTM08-2006 An Evaluation of FZG Micropitting Test Procedures and Results for the Crowned AGMA Test Gears《鼓形AGMA测试齿轮用FZG微点蚀测试程序和结果的评估》.pdf
  • AGMA 06FTM09-2006 Opportunities to Replace Wrought Gears with High Performance PM Gears in Automotive Applications《在汽车应用中用高性能PM齿轮替换精加工齿轮的时机》.pdf AGMA 06FTM09-2006 Opportunities to Replace Wrought Gears with High Performance PM Gears in Automotive Applications《在汽车应用中用高性能PM齿轮替换精加工齿轮的时机》.pdf
  • AGMA 06FTM10-2006 Fabrication Assembly and Test of a High Ratio Ultra Safe High Contact Ratio Double Helical Planetary Transmission for Helicopter Applications《直升机设施用双螺旋混合行星齿轮传动高接触.pdf AGMA 06FTM10-2006 Fabrication Assembly and Test of a High Ratio Ultra Safe High Contact Ratio Double Helical Planetary Transmission for Helicopter Applications《直升机设施用双螺旋混合行星齿轮传动高接触.pdf
  • AGMA 06FTM11-2006 On Tooth Failure Analysis in Small--Teeth--Number Gearing An Analytical Approach《小齿数齿轮上轮齿故障分析 分析方法》.pdf AGMA 06FTM11-2006 On Tooth Failure Analysis in Small--Teeth--Number Gearing An Analytical Approach《小齿数齿轮上轮齿故障分析 分析方法》.pdf
  • AGMA 06FTM12-2006 A Crane Gear Failure Analysis -- Case Study Observations Lessons Learned Recommendations《起重机齿轮疲劳分析.案例研究、观察、课程学习、介绍》.pdf AGMA 06FTM12-2006 A Crane Gear Failure Analysis -- Case Study Observations Lessons Learned Recommendations《起重机齿轮疲劳分析.案例研究、观察、课程学习、介绍》.pdf
  • AGMA 06FTM13-2006 Economic Aspects of Vacuum Carburizing《真空渗碳处理的经济性》.pdf AGMA 06FTM13-2006 Economic Aspects of Vacuum Carburizing《真空渗碳处理的经济性》.pdf
  • AGMA 06FTM14-2006 The Optimal High Speed Cutting of Bevel Gears -- New Tools and New Cutting Parameters《锥齿轮的最佳高速切割.新工具和新切割参数》.pdf AGMA 06FTM14-2006 The Optimal High Speed Cutting of Bevel Gears -- New Tools and New Cutting Parameters《锥齿轮的最佳高速切割.新工具和新切割参数》.pdf
  • AGMA 06FTM15-2006 Optimal Tooth Modifications in Spiral Bevel Gears Introduced by Machine Tool Setting Variation《由机械工具设置变量产生的螺旋伞齿轮轮齿的最佳修形》.pdf AGMA 06FTM15-2006 Optimal Tooth Modifications in Spiral Bevel Gears Introduced by Machine Tool Setting Variation《由机械工具设置变量产生的螺旋伞齿轮轮齿的最佳修形》.pdf
  • 相关搜索
    资源标签

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

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