二级C语言50题库简洁背诵复习版Word格式文档下载.docx
- 文档编号:6412739
- 上传时间:2023-05-06
- 格式:DOCX
- 页数:108
- 大小:1.44MB
二级C语言50题库简洁背诵复习版Word格式文档下载.docx
《二级C语言50题库简洁背诵复习版Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《二级C语言50题库简洁背诵复习版Word格式文档下载.docx(108页珍藏版)》请在冰点文库上搜索。
i<
sl;
i++)
(sl是字母l不是数字1)
(2)t[2*sl]='
\0'
或t[sl+sl]='
sl=strlen(s);
/************found************/
for(i=0;
=s1;
i++)
t[i]=s[i];
for(i=0;
t[sl+i]=s[sl-i-1];
t[sl]='
;
三、程序编写题(对应题库88套编程题--特殊方法练习)
第2套题
voidWriteText(FILE___1___)
{charstr[81];
\nEnterstringwith-1toend:
gets(str);
(1)*fw
(2)str
(3)str
while(strcmp(str,"
-1"
)!
=0){
fputs(___2___,fw);
fputs("
fw);
}
voidReadText(FILE*fr)
\nReadfileandoutputtoscreen:
fgets(str,81,fr);
while(!
feof(fr)){
%s"
___3___);
voidfun(longs,longt)
{longsl=10;
*t=s%10;
(1)voidfun(longs,long*t)
(2)s1=s1*10;
while(s>
0)
{s=s/100;
*t=s%10*sl+*t;
sl=sl*100;
三、程序编写题(对应教材33题—特殊方法练习)
第3套题
math.h>
intfun(char*fname)
{FILE*fp;
inti,n;
floatx;
if((fp=fopen(fname,"
w"
))==NULL)return0;
for(i=1;
=10;
i++)
参考答案
(1)fp
(2)fclose(fp)
(3)myfile3.txt
fprintf(___1___,"
%d%f\n"
i,sqrt((double)i));
\nSucceed!
!
___2___;
\nThedatainfile:
if((fp=fopen(___3___,"
r"
return0;
fscanf(fp,"
%d%f"
&
n,&
x);
while(!
feof(fp))
{printf("
n,x);
return1;
voidfun(intn,int*a)
(1)for(i=j+1;
n;
(2)p=i;
{inti,j,p,t;
for(j=0;
j<
n-1;
j++)
{p=j;
for(i=j+1;
i++)
if(a[p]>
a[i])
t=i;
if(p!
=j)
{t=a[j];
a[j]=a[p];
a[p]=t;
三、程序编写题(对应题库96套编程题—特殊方法练习)
第4套题
intfun(char*source,char*target)
{FILE*fs,*ft;
charch;
(1)"
(2)fs
(3)ft
if((fs=fopen(source,___1___))==NULL)
if((ft=fopen(target,"
ch=fgetc(fs);
feof(___2___))
{putchar(ch);
fputc(ch,___3___);
fclose(fs);
fclose(ft);
\n\n"
voidfun(longs,long*t)
{intd;
longsl=1;
*t=0;
{d=s%10;
(1)if(d%2==0)
(2)s/=10;
if(d%2=0)
{*t=d*sl+*t;
sl*=10;
s\=10;
三、程序编写题(对应题库75套编程题—特殊方法练习)
第5套题
#defineN8
typedefstructlist
{intdata;
structlist*next;
}SLIST;
voidfun(SLIST*h,intx)
{SLIST*p,*q,*s;
s=(SLIST*)malloc(sizeof(SLIST));
(1)x
(2)p
(3)s
s->
data=___1___;
q=h;
p=h->
next;
while(p!
=NULL&
&
x>
p->
data){
q=___2___;
p=p->
next=p;
q->
next=___3___;
longfun(longnum)
(1)longk=1;
(2)num/=10;
longk;
do
{k*=num%10;
num\=10;
}while(num);
return(k);
三、程序编写题(对应题库87套编程题—特殊方法练习)
第6套题
voidfun(SLIST*p)
{SLIST*t,*s;
t=p->
s=p;
while(t->
next!
=NULL)
{s=t;
(1)next
(2)t->
data
(3)t
t=t->
___1___;
%d"
___2___);
next=NULL;
free(___3___);
(1)voidfun(char*a)
(2)print("
%c"
*a);
fun(chara)
{if(*a)
{fun(a+1);
*a);
三、程序编写题(对应题库56套编程题—特殊方法练习)
第7套题
voidfun(SLIST*h)
{SLIST*p,*q;
if(p!
=NULL)
{q=p->
while(q!
{if(p->
data==q->
data)
{p->
next=q->
free(___1___);
(1)q
(2)next
(3)next
q=p->
___2___;
else
{p=q;
q=q->
___3___;
voidfun(inta[],intn)
{inti,j,t,p;
for(j=0;
j<
n-1;
j++){
(1)缺分号
(2)p=i;
p=j
for(i=j+1;
i<
n;
if(a[i]<
a[p])
p=j;
t=a[p];
a[p]=a[j];
a[j]=t;
三、程序编写题(对应题库79套编程题—自己编程练习记答案)
第8套题
intfun(SLIST*h,charch)
{SLIST*p;
intn=0;
=___1___)
{n++;
(1)0或NULL
(2)n
(3)head,ch
if(p->
data==ch)return___2___;
elsep=p->
main()
{SLIST*head;
intk;
chara[N]={'
m'
'
p'
g'
a'
w'
x'
r'
d'
};
head=creatlist(a);
outlist(head);
Enteraletter:
"
scanf("
ch);
k=fun(___3___);
if(k==0)printf("
\nNotfound!
elseprintf("
Thesequencenumberis:
%d\n"
k);
ctype.h>
(1)for(i=0,t=0;
p[i];
(2)c[t]='
fun(char*p)
{inti,t;
charc[80];
For(i=0,t=0;
p[i];
if(!
isspace(*(p+i)))c[t++]=p[i];
c[t]="
\0"
strcpy(p,c);
三、程序编写题(对应题库86套编程题—特殊方法练习)
第9套题
voidfun(SLIST*h,int*n)
(1)*n
(2)next
(3)head
___1___=0;
while(p)
{(*n)++;
inta[N]={12,87,45,32,91,16,20,48},num;
fun(___3___,&
num);
\nnumber=%d\n"
num);
char*fun(char*s,char*t)
char*p,*r,*a;
(1)a=NULL;
(2)if(*r==*p)
a=Null;
while(*s)
{p=s;
r=t;
while(*r)
if(r==p)
{r++;
p++;
elsebreak;
if(*r=='
)a=s;
s++;
returna;
三、程序编写题(对应题库94套编程题—特殊方法练习)
第10套题
intfun(SLIST*h)
ints=0;
(1)data
{
s+=p->
returns;
inta[N]={12,87,45,32,91,16,20,48};
\nsum=%d\n"
fun(___3___));
voidfun(char*s,char*t1,char*t2,char*w)
strcpy(w,s);
while(*w)
(1)while(*r)
(2)*a=*r;
a++;
r++;
{p=w;
r=t1;
while(r)
if(*r==*p){r++;
)
{a=w;
r=t2;
while(*r){
*a=*r;
a++;
r++
w+=strlen(t2);
elsew++;
三、程序编写题(对应题库85套编程题—特殊方法练习)
第11套题
intfun(char(*ss)[N],int*n)
(1)M
(2)<
(3)k
{inti,k=0,len=N;
{len=strlen(ss[i]);
if(i==0)*n=len;
if(len___2___*n)
{*n=len;
k=i;
return(___3___);
char*fun(chartt[])
(1)if(('
<
=tt[i])&
(tt[i]<
='
z'
))
(2)tt[i]-=32;
for(i=0;
tt[i];
/**********found***********/
if(('
<
=tt[i])||(tt[i]<
='
))
tt[i]+=32;
return(tt);
三、程序编写题(对应题库62套编程题—记程序背答案)
第12套题
voidfun(char*s)
{inti,j=0,k=0;
chart1[80],t2[80];
s[i]!
if(s[i]>
0'
&
s[i]<
9'
)
(1)j++
(2)s[i]=t1[i]
(3)j
t2[j]=s[i];
___1___;
elset1[k++]=s[i];
t2[j]=0;
t1[k]=0;
k;
i++)___2___;
i++)s[k+i]=t2[i];
#defineMAXLINE20
fun(char*pstr[6])
{inti,j;
char*p;
for(i=0;
i<
5;
i++){
/**************found**************/
(1)for(j=i+1;
j<
6;
j++)
(2)*(pstr+i)=*(pstr+j);
for(j=i+1,j<
6,j++)
if(strcmp(*(pstr+i),*(pstr+j))>
p=*(pstr+i);
*(pstr+i)=pstr+j;
*(pstr+j)=p;
三、程序编写题(对应题库53套编程题—特殊方法练习)
第13套题
{inti,j,n;
for(i
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 二级 语言 50 题库 简洁 背诵 复习