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

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

1、国家二级 C 语言机试(操作题)模拟试卷 350(无答案)一、程序填空题1 给定程序中,函数 fun 的功能是:计算出形参 s 所指字符串中包含的单词个数,作为函数值返回。为便于统计,规定各单词之间用空格隔开。例如,形参 s 所指的字符串为:This is a C languageprogram ,函数的返回值为6。请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。注意:源程序存放在考生文件夹下的 BLANK1C 中。不得增行或删行,也不得更改程序的结构!#include int fun (char *s) int n=0,flag=0 ;_1_ ; flag=1 ; _3

2、return n;main () char str81; int n:printf (“nEnter a line text:n“) ;gets (str) ;n=fun (str) ;printf(“nThere are d words inthis textnn“,n) ;二、程序修改题2 给定程序 MODI1C 中函数 fun 的功能是:从 n(形参)个学生的成绩中统计出低于平均分的学生人数,此人数由函数值返回,平均分存放在形参 aver 所指的存储单元中。例如,若输入 8 名学生的成绩:805 60 72 905 98 515 88 64则低于平均分的学生人数为:4(平均分为:75

3、5625)。请改正程序中的错误,使它能统计出正确的结果。注意:不要改动 main 函数,不得增行或删行,也不得更改程序的结构!#include #define N 20int fun (float *s,int n,float*aver) float ave,t =00 ;int count = 0,k,i ;t = sk;ave t / n ;if (si void fun (int *s, int t, int *k)main()int a10=876,675f 896 ,101,301,401,980,431,451,777,k;void NONO();fun (a, 10, &k);printf(“d, dn“, k, ak);NONO();void NONO ()/*本函数用于打开文件,输入测试数据,调用 fun 函数,输出数据,关闭文件。*/int a10, i,k,j ;FILE *rf, *wf ;rf= fopen “indat“,“r“);wf=fopen (“outdat“, “w“);for(i = 0 ; i 10 ; i+) for(j=0 ; j 10 ; j+) fscanf(rf, “d“,aj);fun (a, 10, &k);fprintf (wf, “d,dn“,k,ak);fclose (rf);fclose (wf);

展开阅读全文
相关资源
猜你喜欢
  • EN 61810-2-2017 en Electromechanical elementary relays - Part 2 Reliability.pdf EN 61810-2-2017 en Electromechanical elementary relays - Part 2 Reliability.pdf
  • EN 61810-3-2015 en Electromechanical elementary relays - Part 3 Relays with forcibly guided (mechanically linked) contacts.pdf EN 61810-3-2015 en Electromechanical elementary relays - Part 3 Relays with forcibly guided (mechanically linked) contacts.pdf
  • EN 61810-7-2006 en Electromechanical elementary relays Part 7 Test and measurement procedures《机电式初级继电器 第7部分 试验和测量程序 IEC 61810-7 2006》.pdf EN 61810-7-2006 en Electromechanical elementary relays Part 7 Test and measurement procedures《机电式初级继电器 第7部分 试验和测量程序 IEC 61810-7 2006》.pdf
  • EN 61811-1-2015 en Electromechanical telecom elementary relays of assessed quality - Part 1 Generic specification and blank detail specification.pdf EN 61811-1-2015 en Electromechanical telecom elementary relays of assessed quality - Part 1 Generic specification and blank detail specification.pdf
  • EN 61812-1-2011 en Time relays for industrial and residential use - Part 1 Requirements and tests《工业和住宅用时间继电器 第1部分 要求和试验[代替 CENELEC EN 116000-2]》.pdf EN 61812-1-2011 en Time relays for industrial and residential use - Part 1 Requirements and tests《工业和住宅用时间继电器 第1部分 要求和试验[代替 CENELEC EN 116000-2]》.pdf
  • EN 61817-2001 en Household portable appliances for cooking grilling and similar use - Methods for measuring performance (Incorporates Amendment A1 2004)《家用烹饪 烧烤及类似用途的便携式电器性能测试方法 IE.pdf EN 61817-2001 en Household portable appliances for cooking grilling and similar use - Methods for measuring performance (Incorporates Amendment A1 2004)《家用烹饪 烧烤及类似用途的便携式电器性能测试方法 IE.pdf
  • EN 61821-2011 en Electrical installations for lighting and beaconing of aerodromes - Maintenance of aeronautical ground lighting constant current series circuits《机场照明和航路信标用电气装置 航空地.pdf EN 61821-2011 en Electrical installations for lighting and beaconing of aerodromes - Maintenance of aeronautical ground lighting constant current series circuits《机场照明和航路信标用电气装置 航空地.pdf
  • EN 61822-2009 en Electrical installations for lighting and beaconing of aerodromes - Constant current regulators《机场照明和信标导航用电气设备 恒流调节器》.pdf EN 61822-2009 en Electrical installations for lighting and beaconing of aerodromes - Constant current regulators《机场照明和信标导航用电气设备 恒流调节器》.pdf
  • EN 61823-2003 en Electrical installations for lighting and beaconing of aerodromes AGL series transformers《机场照明和信标导航用电气设备 AGL系列变压器 IEC 61823 2002修改件》.pdf EN 61823-2003 en Electrical installations for lighting and beaconing of aerodromes AGL series transformers《机场照明和信标导航用电气设备 AGL系列变压器 IEC 61823 2002修改件》.pdf
  • 相关搜索
    资源标签

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

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