收藏文章 楼主

在指定位置插入字符串 c++

版块:C/C++语言开发   类型:普通   作者:小绿叶技术博客   查看:1128   回复:0   获赞:0   时间:2023-01-31 14:35:35


#include <stdio.h>
#include <string.h>
int main(int argc, const char *argv[])
{
	char dest[30] = "12345";
	char str[] = "abc";
	int n,i=0,j=0;
	printf("请输入插入位置>>>");
	scanf("%d",&n);
	for(i=5;i>=n;i--){
		dest[i+3]=dest[i];
	}
	i=0;
	j=n;
	while(str[i]!='\0'){
		dest[j]=str[i];
		i++;
		j++;
	}
	puts(dest);
 
	return 0;



https://blog.csdn.net/qq_44849419/article/details/127739261



提供企业建站服务,免费网防系统,提交信息登录 http://yundun.ddoss.cn 邮箱: proposal@ddoss.cn 
回复列表
默认   热门   正序   倒序

回复:在指定位置插入字符串 c++

头像

用户名:

粉丝数:

签名:

资料 关注 好友 消息