完成 了任务 ,开始写通讯录
字符串的插入
#include<stdio.h>
#include<string.h>
void insert(char b[],int n,char a[])
{
int i;
for (int i = strlen(b)+1; i >=n; i--)
{
b[i+strlen(a)]=b[i-1];
}
for (int i = 0; i <strlen(a); i++)
{
b[n+i]=a[i];
}
puts(b);
}
int main()
{
int lenth;
int n,i;
char a[]={0};
char b[100]="hello world";
puts(b);
printf("输入想要插入的字符串:");
gets(a);
printf("输入想要插入的字符位置n:");
scanf("%d",&n);
printf("输入想要插入的字符位置n:%d\n",strlen(a));
insert(b,n,a);
while (1)
{
}
return 0;
}