⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄

📁 串的插入算法程序实现
💻
字号:
#include<stdio.h>
#include<string.h>
#define MAX 128
int slength (char ch[])
{
	int i=0;
	while (ch[i]!='\0')i++;
	return i;
} 
int main()
{
	int i,j;
    char ch1[MAX],ch2[MAX],des[MAX];
	printf("input the first string:");
	scanf("%s",ch1);
	printf("input the second string:");
	scanf("%s",ch2);
	if(slength(ch1) + slength(ch2)> MAX) return 1; /*目标串的存贮区不够大*/ 
	for(j=0; j<slength(ch1); j++)
		des[j]= ch1[j];
	for(i=0;i<slength(ch2);j++,i++)
		des[j]= ch2[i];
	des[j]='\0'; /*添加串的结束符号*/
	printf("%s\n",des); 
} 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -