问题与代码:
文件名称:将字符串t插入到字符串s中,在位置pos后插入。不得使用字符串操作函数,输出组合成的字符串。
作者:邓哲
时间:2016年12月11日10:10:05
#include <stdio.h>
int main()
{
char a[50],b[50],c[100];
int i,j=0,pos;
gets(a);
gets(b);
scanf("%d",&pos);
for(i=0; i<pos; i++)
{
c[i]=b[i];
}
while(a[j]!='\0')
{
c[i+j]=a[j];
j++;
}
while(b[i]!='\0')
{
c[i+j]=b[i];
i++;
}
c[i+j]='\0';
puts(c);
return 0;
}