二级C程序设计(一),第1张

二级C程序设计(一),第2张

测试描述:
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
给定程序中的函数乐趣MODI1。C
例如,当s="AABCDE "和t="BDFGG "时,
u中的字符串为:" AACEFGG "。
请更正fun函数中的错误,以便它能得到正确的结果。注意:不要
改变主函数,添加或删除行,或者改变程序的结构!
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
程序:
= = =包含
void fun (char *s,char *t,char *u)
{ int i,j,sl,TL;
sl = strlen(s);TL = strlen(t);
for(I = 0;I { for(j = 0;j if(s[I]= = t[j])break;
/**********找到了* * * * * * * * * */
if(j * u++ = s[I];
}
for(I = 0;I { for(j = 0;j if(t[I]= = s[j])break;
/**********找到了* * * * * * * * * */
if(j * u++ = t[I];
}
* u = ' \ 0 ';
}

main()
{ char s[100],t[100],u[100];
clrscr();
printf(" \ n请输入字符串s:");scanf("%s ",s);
printf(" \ n请输入字符串t:");scanf("%s ",t);
fun(s,t,u);
printf("结果为:%s\n ",u);
}
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
所需数据:[ (jif(tlif(!(tlj))
if(j = = TL)
if(TL = = j)
@ 2 001006
if(j = sl)
if(!(jif(slif(!(slj))
if(sl = = j)
if(j = = sl)

位律师回复
DABAN RP主题是一个优秀的主题,极致后台体验,无插件,集成会员系统
白度搜_经验知识百科全书 » 二级C程序设计(一)

0条评论

发表评论

提供最优质的资源集合

立即查看 了解详情