*
* Copyright (c) 2011, 烟台大学计算机学院
* All rights reserved.
* 作 者:李巧丽
* 完成日期:2012 年 12 月 11 日
* 版 本 号:v1.0
* 输入描述:输入字符串1,字符串2
* 问题描述:略
* 程序输出:输出新字符串
* 算法设计:略
*/
#include <iostream>
using namespace std;
int main( )
{
char str1[50],str2[40];
int i=0,j=0;
cout<<"输入字符串1:"<<endl;
gets(str1);
cout<<"输入字符串2:"<<endl;
gets(str2);
while(str1[i]!='\0')
i++;
while(str2[j]!='\0')
str1[i++]=str2[j++];
str1[i]='\0';
cout<<"新的字符串为:"<<str1<<endl;
return 0;
}
运行结果: