c语言有一个串是”This is a domestic cat!

来源:百度知道 编辑:UC知道 时间:2024/04/29 19:09:05
.”另一个串是”That is a dog!”。编程将第一个串中的” domestic”移动到第二个串中的”dog”之前,使第一个串成为”This is a cat!.”,第二个串成为”That is a domestic dog!”。

以下为可运行的转换程序:
当然,能够实现的方法有很多,只列一种
#include<stdio.h>
#include<string.h>
void main()
{
char str1[30]="This is a domestic cat!";
char str2[30]="That is a dog!";
strcpy(str2+10,str1+10);
strcpy(str2+18," dog!");
strcpy(str1+10,"cat!");
puts(str1);
puts(str2);
}
(仅代表Kutpbpb的个人理解和看法!!!)

a