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

展开阅读全文
相关资源
猜你喜欢
  • ASTM D7990-2015 5422 Standard Test Method for Using Reflectance Spectra to Produce an Index of Temperature Rise in Polymeric Siding《利用反射光谱获得聚合物墙板温升指数的标准试验方法》.pdf ASTM D7990-2015 5422 Standard Test Method for Using Reflectance Spectra to Produce an Index of Temperature Rise in Polymeric Siding《利用反射光谱获得聚合物墙板温升指数的标准试验方法》.pdf
  • ASTM D7991-2015 6072 Standard Test Method for Determining Aerobic Biodegradation of Plastics Buried in Sandy Marine Sediment under Controlled Laboratory Conditions《在受控实验室条件下测定埋在砂质海.pdf ASTM D7991-2015 6072 Standard Test Method for Determining Aerobic Biodegradation of Plastics Buried in Sandy Marine Sediment under Controlled Laboratory Conditions《在受控实验室条件下测定埋在砂质海.pdf
  • ASTM D7992 D7992M-2015 3434 Standard Practice for Elevated Temperature and Moisture Conditioning of Pultruded Fiber Reinforced Polymer (FRP) Composites Used in Structural Designs《结.pdf ASTM D7992 D7992M-2015 3434 Standard Practice for Elevated Temperature and Moisture Conditioning of Pultruded Fiber Reinforced Polymer (FRP) Composites Used in Structural Designs《结.pdf
  • ASTM D7993-2015 0612 Standard Guide for Analyzing Complex Phthalates《分析复合邻苯二甲酸酯的标准指南》.pdf ASTM D7993-2015 0612 Standard Guide for Analyzing Complex Phthalates《分析复合邻苯二甲酸酯的标准指南》.pdf
  • ASTM D7994-2017 0672 Standard Test Method for Total Fluorine Chlorine and Sulfur in Liquid Petroleum Gas (LPG) by Oxidative Pyrohydrolytic Combustion Followed by Ion Chromatography.pdf ASTM D7994-2017 0672 Standard Test Method for Total Fluorine Chlorine and Sulfur in Liquid Petroleum Gas (LPG) by Oxidative Pyrohydrolytic Combustion Followed by Ion Chromatography.pdf
  • ASTM D7996-2015 4974 Standard Test Method for Measuring Visible Spectrum of Asphaltenes in Heavy Fuel Oils and Crude Oils by Spectroscopy in a Microfluidic Platform《在微流体平台利用分光光谱测量重.pdf ASTM D7996-2015 4974 Standard Test Method for Measuring Visible Spectrum of Asphaltenes in Heavy Fuel Oils and Crude Oils by Spectroscopy in a Microfluidic Platform《在微流体平台利用分光光谱测量重.pdf
  • ASTM D7997-2015 0306 Standard Practice for Polyurethane Raw Materials Gel Tests for Polyurethane Non-Foam Formulations《聚亚胺酯原材料的标准实施规程 聚氨酯非发泡剂的凝胶试验》.pdf ASTM D7997-2015 0306 Standard Practice for Polyurethane Raw Materials Gel Tests for Polyurethane Non-Foam Formulations《聚亚胺酯原材料的标准实施规程 聚氨酯非发泡剂的凝胶试验》.pdf
  • ASTM D7998-2015 5417 Standard Test Method for Measuring the Effect of Temperature on the Cohesive Strength Development of Adhesives using Lap Shear Bonds under Tensile Loading《使用拉伸.pdf ASTM D7998-2015 5417 Standard Test Method for Measuring the Effect of Temperature on the Cohesive Strength Development of Adhesives using Lap Shear Bonds under Tensile Loading《使用拉伸.pdf
  • ASTM D7999-2015 0616 Standard Classification for Rubber Products in Natural Gas Pipeline Applications《天然气管线应用橡胶产品的标准分类》.pdf ASTM D7999-2015 0616 Standard Classification for Rubber Products in Natural Gas Pipeline Applications《天然气管线应用橡胶产品的标准分类》.pdf
  • 相关搜索
    资源标签

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

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