📄 2002年4月计算机等级考试二级c语言上机试题(1、2、3).htm
字号:
<BR>#include <BR>#define VSIZE 20</FONT></P>
<P><FONT color=#009900>int vector[VSIZE]
;</FONT></P>
<P><FONT color=#009900>int fun(int list[],int
size)<BR>{//<BR>int i,min=0;<BR>for(i=1; i <
size;
i++)<BR>if(list[min]>list[i])<BR>min=i;<BR>return
min;<BR>//<BR>}</FONT></P>
<P><FONT color=#009900>main()<BR>{<BR>int
i;<BR>clrscr() ;<BR>for
(i=0;i<BR>{<BR>vector[i]=rand();<BR>printf("Vector[%d]=%6d\n",i,vector[i]);<BR>}<BR>i=fun(vector,VSIZE);<BR>printf("\nMininum:
Vector[%d]=%6d\n",i,vector[i]);<BR>NONO();<BR>}</FONT></P>
<P><FONT color=#009900>NONO()<BR>/*
请在此函数内打开文件,输入测试数据,调用 fun 函数,<BR>输出数据,关闭文件。
*/<BR>{<BR>int i;<BR>FILE *fp ;<BR>fp =
fopen("b0203.out", "w") ;<BR>for
(i=0;i<BR>i=fun(vector,VSIZE);<BR>fprintf(fp,
"%d\n", vector[i]) ;<BR>fclose(fp) ;<BR>}<BR>/*
b0203.out
内容:<BR>346<BR>130<BR>10982<BR>1090<BR>11656<BR>7117<BR>17595<BR>6415<BR>22948<BR>31126<BR>9004<BR>14558<BR>3571<BR>22879<BR>18492<BR>1360<BR>5412<BR>26721<BR>22463<BR>25047<BR>130<BR>*/</FONT><BR></P><BR><FONT
color=#ff0000>程序修改题3 </FONT>
<P>code:--------------------------------------------------------------------------------<BR>/*<BR>给定程序MODI1.C中函数fun的功能是:
计算整数n的阶乘。<BR>请改正程序中的错误或在横线处填上适当的内容并把横线删除,<BR>使它能计算出正确的结果。<BR>注意:
不要改动 main 函数, 不得增行或删行,
也不得更改<BR>程序的结构!<BR>*/<BR><FONT
color=#009900>#include "stdio.h"<BR>double fun(int
n)<BR>{<BR>double result=1.0;<BR>while (n>1
&&
n<170)<BR>/*********found*********/<BR>result*=n--;<BR>//result*=--n;<BR>/*********found*********/<BR>return
result;<BR>//return _____;<BR>}</FONT></P>
<P><FONT color=#009900>main()<BR>{<BR>int
n;<BR>clrscr();<BR>printf("Enter an integer:
");<BR>scanf("%d",&n);<BR>printf("\n\n%d!=%lg\n\n",n,fun(n));<BR>NONO();<BR>}</FONT></P>
<P><FONT color=#009900>NONO( )<BR>{<BR>/*
请在此函数内打开文件,输入测试数据,调用 fun 函数,输出数据,关闭文件。 */<BR>int
n,i;<BR>FILE *rf, *wf ;</FONT></P>
<P><FONT color=#009900>rf = fopen("g03.in", "r")
;<BR>wf = fopen("g03.out", "w") ;<BR>for(i=1;
i<=10; i++) {<BR>fscanf(rf, "%d", &n)
;<BR>fprintf( wf, "%lg\n", fun ( n )
);<BR>}<BR>fclose(rf) ;<BR>fclose(wf)
;<BR>}<BR>--------------------------------------------------------------------------------<BR>/*
g03.in 文件内容如下: <BR>5 8 11 6 15 31 18 23 29 37
<BR>*/ <BR>/* g03.out 文件内容如下: <BR>120 <BR>40320
<BR>3.99168e+07 <BR>720 <BR>1.30767e+12
<BR>8.22284e+33 <BR>6.40237e+15 <BR>2.5852e+22
<BR>8.84176e+30 <BR>1.37638e+43 <BR>*/ </FONT></P>
<P><FONT
color=#ff0000><BR> 编程题</FONT><BR>code:--------------------------------------------------------------------------------<BR>/*<BR>编写函数fun,函数的功能是:
从字符串中删除指定的字符。同<BR>一字母的大、小写按不同字符处理。<BR>若程序执行时输入字符串为:
turbo c and borland c++<BR>从键盘上输入字符:n, 则输出后变为:
turbo c ad borlad c++<BR>如果输入的字符在字符串中不存在,
则字符串照原样输出。<BR>注意:
部分源程序在文件PROG1.C中。<BR>请勿改动主函数main和其它函数中的任何内容,
仅在函数fun<BR>的花括号中填入你编写的若干语句。<BR>*/<BR><FONT
color=#009900>#include <BR>#include </FONT></P>
<P><FONT color=#009900>int fun(char s[],int
c)<BR>{//<BR>char *q=s;<BR>for(; *q; q++)<BR>if(*q
!= c) *(s++)=*q;<BR>*s=0;<BR>//<BR>}</FONT></P>
<P><FONT color=#009900><BR>main()<BR>{<BR>static
char str[]="turbo c and borland c++";<BR>char
ch;<BR>clrscr() ;<BR>printf("原始字符串:%s\n",
str);<BR>printf("输入一个字符:");<BR>scanf("%c",&ch);<BR>fun(str,ch);<BR>printf("str[]=%s\n",str);<BR>NONO();<BR>}</FONT></P>
<P><FONT color=#009900>NONO()<BR>{<BR>/*
请在此函数内打开文件,输入测试数据,调用 fun 函数,<BR>输出数据,关闭文件。
*/<BR>FILE *rf, *wf ;<BR>char s[81], ch, w
;<BR>int len ;</FONT></P>
<P><FONT color=#009900>rf = fopen("b0303.in", "r")
;<BR>wf = fopen("b0303.out", "w") ;<BR>fgets(s,
80, rf) ;<BR>fscanf(rf, "%c", &ch) ;<BR>len =
strlen(s) - 1 ;<BR>w = s[len] ;<BR>if(w == '\n' ||
w == 0x1a) s[len] = 0 ;<BR>fun(s, ch)
;<BR>fprintf(wf, "%s", s) ;<BR>fclose(rf)
;<BR>fclose(wf)
;<BR>}<BR>--------------------------------------------------------------------------------<BR>/*
b0303.in 文件内容如下: <BR>You can specify that the
primary index is in record number sequence. <BR>t
<BR>*/ <BR>/* b0303.out 文件内容如下: <BR>You can
specify ha he primary index is in record number
sequence. <BR>*/</FONT></P>
<P></P>
<P> </P>
<P></P>
<P></P>
<P></P>
<P></P>
<P></P>
<P></P>
<P></P>
<P></P>
<P></P>
<P></P>
<P align=center><FONT color=#3300cc>资料收集:beck
Copyright 2002 www.vcok.com, All Rights Reserved
</FONT></P>
<P></P></DIV></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<TABLE align=center bgColor=#d7ebff border=0
borderColorDark=#ffffff cellPadding=0 cellSpacing=0
width=650><TBODY>
<TR align=middle bgColor=#3986ef vAlign=center>
<TD align=left colSpan=2 height=25 id=notice
vAlign=center> <FONT
color=#ffffff><B>[</B>来源<B>]</B>: 不详
<B>[</B>编辑<B>]</B>: <FONT color=#ffffff>beck
</FONT> <B>[</B>加入时间<B>]</B>:2002-8-14
</FONT></TD></TR></TBODY></TABLE><BR><BR>
<TABLE border=0 width="100%">
<TBODY>
<TR>
<TD>
<LI><FONT color=#0772b1>上篇文章</FONT>:<A
href="http://www.vcok.com/class/list.asp?id=292">2001年9月计算机等级考试二级C语言上机试题(13、49、50)</A>
<LI><FONT color=#0772b1>下篇文章</FONT>:<A
href="http://www.vcok.com/class/list.asp?id=294">欢迎参与数据结构版块的建设</A>
</LI></TD>
<TD align=right>
<SCRIPT language=JavaScript>
var onecount;
onecount=0;
subcat = new Array();
subcat[0] = new Array("C语言教程","8","35");
subcat[1] = new Array("C技术文章","8","36");
subcat[2] = new Array("C试题库","8","37");
subcat[3] = new Array("C程序百例","8","38");
subcat[4] = new Array("C函数库","8","39");
subcat[5] = new Array("数据结构教程","9","40");
subcat[6] = new Array("常用算法","9","41");
subcat[7] = new Array("在线测试","8","42");
subcat[8] = new Array("linux入门级","10","43");
onecount=9;
function changelocation(locationid)
{
document.myform.Nclassid.length = 0;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.myform.Nclassid.options[document.myform.Nclassid.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</SCRIPT>
<FORM action=ru_query.asp method=post name=myform>文章搜索:
<SELECT name=action size=1> <OPTION selected
value=title>按文章标题搜索</OPTION> <OPTION
value=writer>按文章来源搜索</OPTION> <OPTION
value=content>按文章内容搜索</OPTION> <OPTION
value=Nkey>按照关键词搜索</OPTION></SELECT> <SELECT
name=classid
onchange=changelocation(document.myform.classid.options[document.myform.classid.selectedIndex].value)
size=1> <OPTION selected value="">请指定范围</OPTION>
<OPTION value=8>C语言教室</OPTION> <OPTION
value=9>数据结构</OPTION> <OPTION
value=10>Linux初探</OPTION></SELECT> <SELECT
name=Nclassid> <OPTION selected
value="">请指定范围</OPTION> <OPTION value=8>C语言教程</OPTION>
<OPTION value=8>C技术文章</OPTION> <OPTION
value=8>C试题库</OPTION> <OPTION value=8>C程序百例</OPTION>
<OPTION value=8>C函数库</OPTION> <OPTION
value=9>数据结构教程</OPTION> <OPTION value=9>常用算法</OPTION>
<OPTION value=8>在线测试</OPTION> <OPTION
value=10>linux入门级</OPTION></SELECT> <INPUT maxLength=50
name=keyword size=10 value=输入关键字> <INPUT name=Submit type=submit value=搜索>
</FORM></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD bgColor=#e6e6e6 width="50%">□- C试题库热点文章</TD>
<TD bgColor=#e6e6e6 width="50%">□- 相关文章</TD></TR>
<TR>
<TD bgColor=#ffffff vAlign=top width="50%">1.<A
href="http://www.vcok.com/class/list.asp?id=293" target=_top
title=2002年4月计算机等级考试二级C语言上机试题(1、2、3)> 2002年4月计算机等级考试二级C语言上...
</A>[阅读:<FONT color=red>16374</FONT>]<BR>2.<A
href="http://www.vcok.com/class/list.asp?id=292" target=_top
title=2001年9月计算机等级考试二级C语言上机试题(13、49、50)>
2001年9月计算机等级考试二级C语言上... </A>[阅读:<FONT
color=red>4179</FONT>]<BR>3.<A
href="http://www.vcok.com/class/list.asp?id=287" target=_top
title=2001年9月计算机等级考试二级C语言上机试题(1、2、3)> 2001年9月计算机等级考试二级C语言上...
</A>[阅读:<FONT color=red>3610</FONT>]<BR>4.<A
href="http://www.vcok.com/class/list.asp?id=288" target=_top
title=2001年9月计算机等级考试二级C语言上机试题(4、5、6)> 2001年9月计算机等级考试二级C语言上...
</A>[阅读:<FONT color=red>2647</FONT>]<BR>5.<A
href="http://www.vcok.com/class/list.asp?id=291" target=_top
title=2001年9月计算机等级考试二级C语言上机试题(10、11、12)>
2001年9月计算机等级考试二级C语言上... </A>[阅读:<FONT
color=red>2600</FONT>]<BR></TD>
<TD bgColor=#ffffff vAlign=top width="50%"><A
href="http://www.vcok.com/class/list.asp?id=293">2002年4月计算机等级考试二级C语言上机试题(1、2、3)</A><BR><A
href="http://www.vcok.com/class/list.asp?id=292">2001年9月计算机等级考试二级C语言上机试题(13、49、50)</A><BR><A
href="http://www.vcok.com/class/list.asp?id=289">2001年9月计算机等级考试二级C语言上机试题(7、8、9)</A><BR><A
href="http://www.vcok.com/class/list.asp?id=288">2001年9月计算机等级考试二级C语言上机试题(4、5、6)</A><BR><A
href="http://www.vcok.com/class/list.asp?id=287">2001年9月计算机等级考试二级C语言上机试题(1、2、3)</A><BR></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<DIV></DIV>
<TABLE bgColor=#ffffff border=0 width=778>
<TBODY>
<TR bgColor=#ffffff>
<TD colSpan=3></TD></TR>
<TR vAlign=baseline>
<TD colSpan=3>
<HR noShade SIZE=1>
</TD></TR>
<TR>
<TD width="7%"> </TD>
<TD width="87%">
<DIV align=center>唯C世界|<FONT
face="Arial, Helvetica, sans-serif">http://wWw.VcOk.Com</FONT> <FONT
face="Arial, Helvetica, sans-serif">Ver 1.00 Design By <FONT
face="Verdana, Arial, Helvetica, sans-serif"><B><FONT
color=#ff0000><A href="http://www.vcok.com/"><FONT
color=#ff0009>VcOk.com</FONT></A></FONT></B></FONT></FONT></FONT></DIV></TD>
<TD width="6%"> </TD></TR>
<TR>
<TD width="7%"> </TD>
<TD width="87%">
<DIV align=center><FONT
face="Arial, Helvetica, sans-serif">CopyRight <FONT
color=#ff0000>©</FONT> .:.:.:2002-2008 AT Tie Ling Liaoning
China:.:.:.</FONT></DIV></TD>
<TD width="6%"> </TD></TR>
<TR>
<TD width="7%"> </TD>
<TD align=middle
width="87%"> 辽宁省铁岭师范高等专科学校计算机中心
</TD></TR></TBODY></TABLE>
<TABLE bgColor=#b5b6b5 cellSpacing=1 height=30 width=778>
<TBODY>
<TR>
<TD align=middle bgColor=#ffffff>在此感谢 <A
href="http://www.kingxp.com/">广东省中联科技网络有限公司</A> 为我公司提供空间。/ 合作伙伴:<A
href="http://www.11k.net/">中国站长资讯网</A></TD></TR></TBODY></TABLE></TR></TBODY></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -