安徽省二级c语言上机试题Word文档格式.docx

上传人:b****3 文档编号:6204631 上传时间:2023-05-06 格式:DOCX 页数:28 大小:523.35KB
下载 相关 举报
安徽省二级c语言上机试题Word文档格式.docx_第1页
第1页 / 共28页
安徽省二级c语言上机试题Word文档格式.docx_第2页
第2页 / 共28页
安徽省二级c语言上机试题Word文档格式.docx_第3页
第3页 / 共28页
安徽省二级c语言上机试题Word文档格式.docx_第4页
第4页 / 共28页
安徽省二级c语言上机试题Word文档格式.docx_第5页
第5页 / 共28页
安徽省二级c语言上机试题Word文档格式.docx_第6页
第6页 / 共28页
安徽省二级c语言上机试题Word文档格式.docx_第7页
第7页 / 共28页
安徽省二级c语言上机试题Word文档格式.docx_第8页
第8页 / 共28页
安徽省二级c语言上机试题Word文档格式.docx_第9页
第9页 / 共28页
安徽省二级c语言上机试题Word文档格式.docx_第10页
第10页 / 共28页
安徽省二级c语言上机试题Word文档格式.docx_第11页
第11页 / 共28页
安徽省二级c语言上机试题Word文档格式.docx_第12页
第12页 / 共28页
安徽省二级c语言上机试题Word文档格式.docx_第13页
第13页 / 共28页
安徽省二级c语言上机试题Word文档格式.docx_第14页
第14页 / 共28页
安徽省二级c语言上机试题Word文档格式.docx_第15页
第15页 / 共28页
安徽省二级c语言上机试题Word文档格式.docx_第16页
第16页 / 共28页
安徽省二级c语言上机试题Word文档格式.docx_第17页
第17页 / 共28页
安徽省二级c语言上机试题Word文档格式.docx_第18页
第18页 / 共28页
安徽省二级c语言上机试题Word文档格式.docx_第19页
第19页 / 共28页
安徽省二级c语言上机试题Word文档格式.docx_第20页
第20页 / 共28页
亲,该文档总共28页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

安徽省二级c语言上机试题Word文档格式.docx

《安徽省二级c语言上机试题Word文档格式.docx》由会员分享,可在线阅读,更多相关《安徽省二级c语言上机试题Word文档格式.docx(28页珍藏版)》请在冰点文库上搜索。

安徽省二级c语言上机试题Word文档格式.docx

将在字符串t中而为在字符串s中的字符顺序存放到一个新的字符u中。

如当s=12345,t=2468时,u中的字符为“68”

#include<

string.h>

chars[80]="

12345"

t[80]="

2468"

u[80];

inti,j,p,len1,len2;

p=____;

/*$BLANK1$*/

len1=strlen(t);

len2=strlen(s);

for(i=0;

i<

len1;

i++)

for(j=0;

len2;

if(t[i]==s[j])break;

if(j>

=len2)

{

u[p]=____;

/*$BLANK2$*/

p++;

}

u[p]=____;

/*$BLANK3$*/

%s\n"

u);

t[i]

\0

3:

程序设计:

[三色球问题]若一个口袋中方有12的球,3的红色,3的白色,6个黑色。

从中任取8个球,求共有多少种不同的颜色搭配。

如1红,3白,4黑。

等。

输入格式:

count=123

voidPRINT(intn)

FILE*out;

count=%d\n"

n);

if((out=fopen("

K:

\\24000101\\RESULT.DAT"

"

w+"

))!

=NULL)

fprintf(out,"

count=%dp"

fclose(out);

intr,w,b;

intn=0;

for(r=0;

r<

=3;

r++)

for(w=0,w<

=3,w++)

for(b=0;

b<

=6;

b++)

if(r+w+b==8)n++;

PRINT(n);

 

1:

改错

inti,j;

i=1;

while(i<

6)

for(j=1;

6-i;

printf("

"

);

j=1;

/*$ERROR1$*/

while(j>

=1)

{

%d"

/*$ERROR2$*/

--j;

printf("

/n"

/*$ERROR3$*/

i++;

J=I;

Printf(“%d”,j)

Printf(“\n”)

程序填空

floatsum(floatq)

intN=1;

floatSN=0;

while(SN__q)/*$BLANK1$*/

SN=SN+1.0*(N+1)/N;

____;

returnSN;

floatq;

Inputq:

"

scanf("

%f"

&

q);

%f\n"

_____);

<

=

N++

sum(q))

3程序设计

voidPRINT(longsum)

sum=%ld\n"

sum);

sum=%lds"

Iongsum=0;

intI,n,flag;

for(i=100;

2011;

{flag=0;

n=i;

do{

if(n%10==5)

elsen=n/10;

}while(n>

0);

if(flag&

&

i%3==0)

sum+=i

PRINT(sum);

#defineN4

#defineM5

{

inti,j;

floatscore,firstscore,max;

for(i=1;

=M;

\nPleaseinputscoreofcourseno%d:

scanf("

firstscore);

/*$ERROR1$*/

max=&

firstscore;

/*$ERROR2$*/

for(j=2;

=N;

j++)

scanf("

&

score);

if(score>

max)

score=max;

\nThemaxscoreofcourseno%dis:

%f"

i,max);

答案;

2:

intfun(intn)

inti,sum=0;

for(i=2;

_____;

i++)/*$BLANK1$*/

if(_____)sum=sum+i;

returnsum;

intn;

Inputn:

n);

intgetMaxFromArray(inta[],intn)

inti,max;

max=1;

/*$ERROR1$*/

n;

if(a[i]>

a[max])

max=i;

returni;

/*$ERROR2$*/

inta[10]={13,1,-5,4,9,0,-8,7,-6,2};

intmax;

max=getMaxFromArray(a);

max=%d,address=%d\n"

a[max],max);

charstr[80],*ch;

intflag=1;

Pleaseinputastring:

\n"

gets(str);

ch=____;

while(*ch)

if(*ch=='

'

)flag=1;

else

if(flag==____&

*ch>

='

a'

&

*ch<

z'

)/*$BLANK2$*/

*ch=*ch-32;

flag=0;

____;

str);

程序设计

intsum(intn)

inti,s;

s=1;

=n;

s=s+i;

returns;

inti,n;

longs;

\nPleaseinputn:

s=0;

s=sum(i);

\nTheresultis%ld\n"

s);

voidfun(ints[],int*n)

inta,b,c,i;

for(i=100;

=999;

a=______;

b=i/10%10;

c=i%10;

if(a+b+c==9)

s[*n]=i;

______;

/*$BLANK2$*/

}

ints[50],n=0,i;

fun(_____);

%d"

s[i]);

3;

structcar

{charid[12];

intscore;

};

inti,n=0;

carc[6]={{"

A-QQ111"

8},/*$ERROR1$*/

{"

A-TT222"

12},

B-WJ333"

C-LC444"

5},

F-PC555"

6},

B-MY666"

12}};

id\tscore\n"

i=0;

6)

if(score>

=12)/*$ERROR2$*/

%s\t%d\n"

c[i].id,c[i].score);

n--;

i++;

n=%d\n"

ctype.h>

chars[80];

inti=0,a[5]={0};

gets(____);

while(s[i]!

=_____)/*$BLANK2$*/

switch(toupper(s[i]))

case'

A'

:

a[0]++;

break;

E'

a[1]++;

I'

a[2]++;

O'

a[3]++;

U'

a[4]++;

______;

5;

a[i]);

longf(intn)

if(n=1||n=2)/*$ERROR1$*/

return1;

else

returnf(n-1)-f(n-2);

longm;

if(n>

0)

m=f(n);

%ld\n"

m);

elseprintf("

Dataerror\n"

voidfun(chars[])

for(i=0,j=0;

s[i]!

=_____;

if(s[i]<

'

0'

||s[i]>

9'

s[j++]=s[i];

s[j]=____;

charstr[80];

Inputastring:

gets(_____);

fun(str);

puts(str);

intsort(inta[],intlenth)

inti,t;

if(lenth<

return-1;

lenth/2;

t=a[0];

a[i]=a[lenth-i-1];

a[lenth-i-1]=t;

/*$ERROR2$*/

inta[10]={1,2,3,4,5,6,7,8,9,10};

inti,nReturn;

\nTheascendingarrayis:

10;

%4d"

nReturn=sort(10);

if(nReturn==0)

\nThedescendingarrayis:

for(i=0;

else

error!

inta[10]={34,-5,12,50,88,62,1,-70,-20,0};

inti,j,temp;

for(i=0;

9;

9-i;

if(_____)/*$BLANK1$*/

{

temp=a[j];

a[j]=a[j+1];

a[j+1]=_____;

}

=9;

%5d"

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 考试认证 > IT认证

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2