📄 17.c
字号:
#include "stdio.h"
#include "string.h"
void main(){
char source[200],sub[100],destination[100];
int slen,dlen,pos,i,temp;
printf("Input the source string:");
gets(source);
printf("\nInput the destination string:");
gets(destination);
slen=strlen(source);
dlen=strlen(destination);
printf("\nInput the pos you want to insert:");
scanf("%d",&pos);
if (pos>slen||pos<1)
{
printf("Position Error!!");
return;
}
else{
temp=pos-1;
for(i=0;i<=slen-pos+1;i++)
sub[i]=source[temp++];
puts(sub);
source[pos-1]='\0';
strcat(source,destination);
strcat(source,sub);
}
puts(source);
printf("\n");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -