二级C程序修改(七)
测试描述:
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
给定程序中的函数乐趣MODI1。C
例如,当s = "AABCDE "和t = "BDFG "时,
u中的字符串是" AACE "。
请更正fun函数中的错误,以便它能得到正确的结果。注意:不要
改变主函数,添加或删除行,或者改变程序的结构!
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
程序:
= = = = = = = = = = =包含
/* * * * * * * * * * * *找到* * * * * * * * * * * */
void fun(char * s,char *t,char u)
{ int i,j,sl,TL;
sl = slen(s);TL = slen(t);
for(I = 0;I { for(j = 0;j if(s[I]= = t[j])break;
/**********找到了* * * * * * * * * * */
if(j > TL)
* u = s[I];
}
* u = ' \ 0 ';
}
main()
{ char s[100],t[100],u[100];
clrscr();
printf(" \ n请输入歌曲:");scanf("%s ",s);
printf(" \ n请输入sing t:");scanf("%s ",t);
fun(s,t,u);
printf("结果为:%s\n ",u);
}
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
所需数据:[ br/]void fun (char *s,char *t,char *u)
void fun (char *s,char *t,char u[])
void fun (char *s,char *t,char u[100])
fun (char *s,char *t,char * u)
char u[])
fun (char *s,char *t,char u[100])
fun (char s[],char t[],char u[])
fun (char s[100],char t[100],char u[100])
void fun(char s[],char t[],char u[])
void fun(char s[100],char t[100],char u[100])[] (jif(!(TL > j))
if(j = = TL)
if(TL = = j)
0条评论