C语言考试题Word格式文档下载.docx
- 文档编号:22396903
- 上传时间:2023-02-03
- 格式:DOCX
- 页数:139
- 大小:43.08KB
C语言考试题Word格式文档下载.docx
《C语言考试题Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《C语言考试题Word格式文档下载.docx(139页珍藏版)》请在冰豆网上搜索。
=y;
i++)题
t=t*x;
*p=t;
t=t%1000;
returnt;
{longt,r;
intx,y;
\nInputxandy:
"
scanf("
%ld%ld"
&
x,&
y);
t=fun(x,y,&
r);
\n\nx=%d,y=%d,r=%ld,last=%ld\n\n"
x,y,r,t);
3、程序设计题校园网·
{inti=0;
doubles=1,a=1;
while(fabs(a)>
0.000001)
{
a=a*(0.5-i)*x/(i+1);
s+=a;
i++;
}
returns;
{doublex,s;
printf("
Inputx:
%lf"
x);
s=fun(x);
s=%f\n"
s);
第2套校园网·
intc1,c2,c3;
voidfun(longn)
{c1=c2=c3=0;
while(n){
switch(n%10)题
{
/**********found**********/题
case1:
c1++;
break;
case2:
c2++;
break_;
case3:
c3++;
n/=10;
{longn=123114350L;
fun(n);
\nTheresult:
n=%ldc1=%dc2=%dc3=%d\n"
n,c1,c2,c3);
#include<
intfun(unsignedn,int*zero)
{intcount=0,max=0,t;
do
{t=n%10;
if(t==0)题
count++;
if(max<
t)max=t;
n=n/10;
}while(n);
*zero=count;
returnmax;
{unsignedn;
intzero,max;
\nInputn(unsigned):
%d"
n);
max=fun(n,&
zero);
\nTheresult:
max=%dzero=%d\n"
max,zero);
doublefun(intn)
doubles=0,a=1;
for(i=1;
i<
=n;
i++)
a=a/i;
{intn;
doubles;
\nInputn:
s=fun(n);
\n\ns=%f\n\n"
第3套校园网·
unsignedlongfun(unsignedlongn)
{unsignedlongx=0;
intt;
while(n)
if(t%2==0)题
x=10*x+t;
returnx;
{unsignedlongn=-1;
while(n>
99999999||n<
0)
{printf("
Pleaseinput(0<
n<
100000000):
%ld"
}
\nTheresultis:
%ld\n"
fun(n));
voidfun(longs,long*t)
{intd;
longsl=1;
/************found************/
*t=0;
while(s>
0)
{d=s%10;
if(d%2!
=0)题
{*t=d*sl+*t;
sl*=10;
s/=10;
{longs,t;
\nPleaseenters:
"
&
s);
fun(s,&
t);
Theresultis:
t);
voidfun(charp1[],charp2[])
while(*p1)p1++;
while(*p2)
*p1=*p2;
p1++;
p2++;
*p1=0;
题
Enters1ands2:
);
scanf("
%s%s"
s1,s2);
s1=%s\n"
s1);
s2=%s\n"
s2);
Invokefun(s1,s2):
fun(s1,s2);
Afterinvoking:
%s\n"
第4套校园网·
#defineM3
#defineN4
voidfun(int(*a)[N])
{inti=0,j,find=0,rmax,c,k;
while((i<
M)&
&
(!
find))
{rmax=a[i][0];
c=0;
for(j=1;
j<
N;
j++)
if(rmax<
a[i][j]){
rmax=a[i][j];
c=J;
}题
find=1;
k=0;
while(k<
M&
find){
if(k!
=i&
a[k][c]<
=rmax)find=0;
k++;
if(find)printf("
find:
a[%d][%d]=%d\n"
i,c,a[i][c]);
i++;
if(!
find)printf("
notfound!
{intx[M][N],i,j;
Enternumberforarray:
for(i=0;
M;
i++)
for(j=0;
j++)scanf("
x[i][j]);
Thearray:
{for(j=0;
j++)printf("
%3d"
x[i][j]);
\n\n"
fun(x);
doublefun(intm)
{doubley=1.0;
inti;
for(i=2;
i<
=m;
y-=1.0/i/i;
return(y);
main()
{intn=5;
printf("
\nTheresultis%lf\n"
fun(n));
string.h>
intfun(intscore[],intm,intbelow[])
{inti=0,s=0,n=0;
for(i=0;
m;
i++)s+=score[i];
s/=m;
if(score[i]<
s)
below[n]=score[i];
n++;
returnn;
intscore[9]={10,20,30,40,50,60,70,80,90};
n=fun(score,9,below);
\nBelowtheaveragescoreare:
);
for(i=0;
n;
i++)printf("
%d"
below[i]);
第5套校园网·
#defineN5
#defineM10
voidfun(char(*ss)__1__,intk)
{inti=0;
while(i<
__2__){
ss[i][k]=__3__;
{charx[N][M]={"
Create"
"
Modify"
Sort"
skip"
Delete"
};
inti;
\nTheoriginalstring\n\n"
i++)puts(x[i]);
fun(x,4);
\nThestringafterdeleted:
i++)puts(x[i]);
doublefun(doubleeps)
{doubles,t;
intn=1;
s=0.0;
t=0;
while(t>
eps)
{s+=t;
t=t*n/(2*n+1);
return(s);
{doublex;
\nPleaseenteraprecision:
\neps=%lf,Pi=%lf\n\n"
x,fun(x));
voidfun(char*a,intn)
/*以下代码仅供参考*/
inti=0,j,k=0;
while(a[k]=='
*'
)k++;
/*k为统计*字符个数*/
if(k>
n)
i=n;
j=k;
/*以下完成将下标为k至串尾的字符前移k-n个位置*/
Enterastring:
gets(s);
Entern:
fun(s,n);
Thestringafterdeleted:
puts(s);
第6套校园网·
voidfun(int(*t)___1___)
{inti,j;
i;
___2___=t[i][j]+t[j][i];
___3___=0;
{intt[][N]={21,12,13,24,25,16,47,38,29,11,32,54,42,21,33,10},i,j;
\nTheoriginalarray:
%2d"
t[i][j]);
fun(t);
stdlib.h>
#defineFU(m,n)(m/n)
floatfun(floata,floatb,floatc)
{floatvalue;
value=FU(a+b,a-b)+FU(c+b,c-b);
Return(Value);
{floatx,y,z,sum;
Inputxyz:
%f%f%f"
y,&
z);
x=%f,y=%f,z=%f\n"
x,y,z);
if(x==y||y==z){printf("
Dataerror!
exit(0);
sum=fun(x,y,z);
Theresultis:
%5.2f\n"
sum);
voidfun(char*a)
{chars[81];
fun(s);
第7套校园网·
#defineN3
#defineM4
voidfun(int(*a)[N],int__1__)
{inti,temp;
for(i=0;
__2__;
{temp=a[0][i];
a[0][i]=__3__;
a[k][i]=temp;
{intx[M][N]={{1,2,3},{4,5,6},{7,8,9},{10,11,12}},i,j;
Thearraybeforemoving:
fun(x,2);
Thearrayaftermoving:
voidfun(chart[])
charc;
inti,j;
/**********found***********/
for(i=strlen(t);
i;
i--)
for(j=0;
j<
j++)
if(t[j]<
t[j+1])
c=t[j];
t[j]=t[j+1];
t[j+1]=c;
chars[81];
\nPleaseenteracharacterstring:
);
gets(s);
\n\nBeforesorting:
\n\"
%s\"
s);
\nAftersortingdecendingly:
voidfun(char*ss)
voidmain(void)
\nPleaseenterancharacterstringwithin50characters:
gets(tt);
\n\nAfterchanging,thestring\n\"
tt);
fun(tt);
\nbecomes\n\"
第8套校园网·
intfun(intx)
{intn,s1,s2,s3,t;
n=0;
t=100;
while(t<
=__1__){
s1=t%10;
s2=(__2__)%10;
s3=t/100;
if(s1+s2+s3==__3__)
t);
t++;
returnn;
{intx=-1;
while(x<
Pleaseinput(x>
0):
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 语言 考试题