俺是新手,菜鸟一个,刚学C++,
刚编了个字符相加的程序,功能是,将两个字符相加,例如:输入hello,和world两个字符,便输出helloworld
可是总是出错,用strcpy,和strcat函数时,也报错;
最后,编译时没错,可是运行不了,着实郁闷,望哪位高手,帮忙写个程序,让俺看看
谢谢了先!
Example
/* STRCPY.C: This program uses strcpy
* and strcat to build a phrase.
*/
#include <string.h>
#include <stdio.h>
void main( void )
{
char string[80];
strcpy( string, "Hello world from " );
strcat( string, "strcpy " );
strcat( string, "and " );
strcat( string, "strcat!" );
printf( "String = %s\n", string );
}
Output
String = Hello world from strcpy and strcat!
[此贴子已经被作者于2006-11-23 8:34:36编辑过]