C语言:从键盘输入两个字符串s1与s2,并在s1串中的最大字符后边插s2 20
展开全部
//#include "stdafx.h"//vc++6.0加上这一行.
#include "stdio.h"
#include "string.h"
void main(void){
char s1[400]="",s2[400]="",mch;
int i,j,k,sub;
printf("Type a string...\ns1=");
gets(s1);
printf("Type another...\ns2=");
gets(s2);
for(mch=i=0;s1[i];i++)
if(mch<s1[i]){
sub=i;
mch=s1[i];
}
strcats2,s1+sub+1);
s1[sub+1]='\0';
strcat(s1,s2);
printf("The result is %s\n",s1);//Look at it.
}
#include "stdio.h"
#include "string.h"
void main(void){
char s1[400]="",s2[400]="",mch;
int i,j,k,sub;
printf("Type a string...\ns1=");
gets(s1);
printf("Type another...\ns2=");
gets(s2);
for(mch=i=0;s1[i];i++)
if(mch<s1[i]){
sub=i;
mch=s1[i];
}
strcats2,s1+sub+1);
s1[sub+1]='\0';
strcat(s1,s2);
printf("The result is %s\n",s1);//Look at it.
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询