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

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

1、国家二级 C 语言机试(操作题)模拟试卷 370(无答案)一、程序填空题1 给定程序中,函数 fun 的功能是:在带有头结点的单向链表中,查找数据域中值为 ch 的结点。找到后通过函数值返回该结点在链表中所处的顺序号;若不存在值为 ch 的结点,函数返回 0 值。请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。注意:源程序存放在考生文件夹下的 BLANK1C 中。不得增行或删行,也不得更改程序的结构!#include #include #define N 8typedef struct list int data;struct list *next; SLIST;SLIS

2、T *creatlist (char *) ;void outlist (SLIST *) ;int fun(SLIST *h,char ch)SLIST *p; int n=0;p=hnext ;while (p ! = _1_)if (pdata=ch) return_2_;else p=pnext;return 0;main ()SLIST *head; int k; char ch;head=creatlist (a) ;outlist (head) ;printf (“Enter a letter:“) ;scanf ( “ c“,&ch) ;if (k=0) printf (“nN

3、ot found! n“) ;else printf “The sequence numberis : dn“,k) ;SLIST *creatlist (char *a)SLIST *h,*pt*q; int i;h=p=(SLIST *) malloc (sizeof (SLIST) ; q= (SLIST *) malloc (sizeof (SLIST) ;qdata=a i ; p next=q; p=q ;pnext=0;return h;void outlist (SLIST *h)SLIST *p;p=hnext ;if (p=NULL) printf(“nThe listis

4、 NULL ! n“) ;else printf (“nHead“) ;do printf ( “ooc“,pdata) ;p=pnext; while (p ! =NULL) ;printf ( “Endn“) ;二、程序修改题2 给定程序 MODI1C 中函数 fun 的功能是:删除 p 所指字符串中的所有空白字符(包括制表符、回车符及换行符)。输入字符串时用“#”结束输入。请改正程序中的错误,使它能输出正确的结果。注意:不要改动 main 函数,不得增行或删行,也不得更改程序的结构!#include #include #includefun (char *p) int i,t; char

5、 c80 ;/*found*/ pil;/*found*/ strcpy (pr c) ;main () char c,s 80 ;int i=0;printf (“Input a string:“) ;c=getchar () ;while(c!=#)fun (s) ;puts (s) ;三、程序设计题3 请编写一个函数 fun,它的功能是:将 SS 所指字符串中所有下标为奇数位置上的字母转换为大写(若该位置上不是字母,则不转换)。例如,若输入”abc4EFg” ,则应输出”aBc4EFg”。注意:部分源程序存在文件 PROG1C 中。请勿改动主函数 main 和其他函数中的任何内容,仅在函

6、数 fun 的花括号中填入你编写的若干语句。#include #include void fun (char *ss)main()char tt 81 ;void NONO ();printf(“nPlease enter an stringwithin 80 characters:n“);gets (tt);printf(“nnAfter changing, thestringn “s“ ,tt);fun (tt);printf(“nbecomesn“s“n“,tt);NONO ();void NONO ()/*本函数用于打开文件,输入数据,调用函数,输出数据,关闭文件。 */FILE *fp,*wf ;char tt 81 ;int i ;fp= fopen (“indat“,“r“);wf = fopen (“outdat“, “w“) ;for(i = 0 ; i 10 ; i+)fscanf (fp, “s“, tt) ;fun (tt) ;fprintf (wf, “ s n“ , tt) ;fclose ( fp) ;fclose (wf) ;

展开阅读全文
相关资源
猜你喜欢
  • BS IEC 61691-1-1-2011 Behavioural languages VHDL Language reference manual《行为语言 VHDL语言参考手册》.pdf BS IEC 61691-1-1-2011 Behavioural languages VHDL Language reference manual《行为语言 VHDL语言参考手册》.pdf
  • BS IEC 61747-40-2-2015 Liquid crystal display devices Mechanical testing of display cover glass for mobile devices Uniaxial flexural strength (4-point bend)《液晶显示装置 移动设备用显示保护玻璃的机械试验.pdf BS IEC 61747-40-2-2015 Liquid crystal display devices Mechanical testing of display cover glass for mobile devices Uniaxial flexural strength (4-point bend)《液晶显示装置 移动设备用显示保护玻璃的机械试验.pdf
  • BS IEC 61747-40-3-2015 Liquid crystal display devices Mechanical testing of display cover glass for mobile devices Biaxial flexural energy to failure (ball drop)《液晶显示装置 移动设备用显示保护玻璃.pdf BS IEC 61747-40-3-2015 Liquid crystal display devices Mechanical testing of display cover glass for mobile devices Biaxial flexural energy to failure (ball drop)《液晶显示装置 移动设备用显示保护玻璃.pdf
  • BS IEC 61747-40-4-2015 Liquid crystal display devices Mechanical testing of display cover glass for mobile devices Biaxial flexural strength (ring-on-ring)《液晶显示装置 移动设备用显示保护玻璃的机械试验 .pdf BS IEC 61747-40-4-2015 Liquid crystal display devices Mechanical testing of display cover glass for mobile devices Biaxial flexural strength (ring-on-ring)《液晶显示装置 移动设备用显示保护玻璃的机械试验 .pdf
  • BS IEC 61858-2-2014 Electrical insulation systems Thermal evaluation of modifications to an established electrical insulation system (EIS) Form-wound EIS《电气绝缘系统 对已确立绕线(EIS)改进的热评定 成.pdf BS IEC 61858-2-2014 Electrical insulation systems Thermal evaluation of modifications to an established electrical insulation system (EIS) Form-wound EIS《电气绝缘系统 对已确立绕线(EIS)改进的热评定 成.pdf
  • BS IEC 61865-2002 Overhead lines - Calculation of the electrical component of distance between live parts and obstacles - Method of calculation《架空电线 带电部分和障碍物间距离的电气元件的计算 计算方法》.pdf BS IEC 61865-2002 Overhead lines - Calculation of the electrical component of distance between live parts and obstacles - Method of calculation《架空电线 带电部分和障碍物间距离的电气元件的计算 计算方法》.pdf
  • BS IEC 61888-2003 Nuclear power plants - Instrumentation important to safety - Determination and maintenance of trip setpoints《核电厂 有关安全的仪器仪表 事故保护定值器的测定和维护》.pdf BS IEC 61888-2003 Nuclear power plants - Instrumentation important to safety - Determination and maintenance of trip setpoints《核电厂 有关安全的仪器仪表 事故保护定值器的测定和维护》.pdf
  • BS IEC 61892-1-2015 Mobile and fixed offshore units Electrical installations General requirements and conditions《移动式及固定式海上设施 电气装置 一般要求和条件》.pdf BS IEC 61892-1-2015 Mobile and fixed offshore units Electrical installations General requirements and conditions《移动式及固定式海上设施 电气装置 一般要求和条件》.pdf
  • BS IEC 61892-2-2012 Mobile and fixed offshore units Electrical installations System design《移动式及固定式近海装置 电气设施 系统设计》.pdf BS IEC 61892-2-2012 Mobile and fixed offshore units Electrical installations System design《移动式及固定式近海装置 电气设施 系统设计》.pdf
  • 相关搜索
    资源标签

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

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