输入字符串s1和s2以及插入位置f,在字符串s1中的指定位置f处插入字符串s2

输入字符串s1和s2以及插入位置f,在字符串s1中的指定位置f处插入字符串s2,第1张

输入字符串s1和s2以及插入位置f,在字符串s1中的指定位置f处插入字符串s2

题目要求:


#include "stdio.h"
#include "string.h"
#define MAX 1000
int main(void) {
	char s1[MAX],s2[MAX];
	int i,j,f,m,n;
	gets(s1);
	gets(s2);
	m=strlen(s1);
	n=strlen(s2);
	scanf("%d",&f);	//插入位置
	for(i=m; i>f-1; i--)
		s1[i+n]=s1[i];	//向后移动	
	for(j=0,i=f; i

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5520640.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-12-13
下一篇2022-12-13

发表评论

登录后才能评论

评论列表(0条)

    保存