#include"stdio.h"
#include"conio.h"
#include"math.h"
main()
{char c,str1[100],str2[100],str3[300];
int i,j;
printf("Please input the first string\nConfirm by Enter\n");
gets(str1);
printf("Please input the second string\nConfirm by Enter\n");
gets(str2);
for(i=0;(c=str1<i>)!='\0';i++)
{str3<i>=str1<i>;
};
j=i;
for(i=0;(c=str1[i])!='\0';i++)
for(i=0;(c=str2<i>)!='\0';i++,j++)
{str3[j]=str2<i>;
};
printf("The string which has been connected is:\n%s",str3);
getch();
}
扩展资料:
include用法:
#include命令预处理命令的一种,预处理命令可以将别的源代码内容插入到所指定的位置;可以标识出只有在特定条件下才会被编译的某一段程序代码;可以定义类似标识符功能的宏,在编译时,预处理器会用别的文本取代该宏。
插入头文件的内容
#include命令告诉预处理器将指定头文件的内容插入到预处理器命令的相应位置。有两种方式可以指定插入头文件:
1、#include<文件名>
2、#include"文件名"
如果需要包含标准库头文件或者实现版本所提供的头文件,应该使用第一种格式。如下例所示:
#include<math.h>//一些数学函数的原型,以及相关的类型和宏
如果需要包含针对程序所开发的源文件,则应该使用第二种格式。
采用#include命令所插入的文件,通常文件扩展名是.h,文件包括函数原型、宏定义和类型定义。只要使用#include命令,这些定义就可被任何源文件使用。如下例所示:
#include"myproject.h"//用在当前项目中的函数原型、类型定义和宏
你可以在#include命令中使用宏。如果使用宏,该宏的取代结果必须确保生成正确的#include命令。例1展示了这样的#include命令。
【例1】在#include命令中的宏
#ifdef _DEBUG_
#define MY_HEADER"myProject_dbg.h"
#else
#define MY_HEADER"myProject.h"
#endif
#include MY_HEADER
当上述程序代码进入预处理时,如果_DEBUG_宏已被定义,那么预处理器会插入myProject_dbg.h的内容;如果还没定义,则插入myProject.h的内容。
参考资料: