相关代码 |
|
#include #include void main( void ) { //拷贝字符串常量到字符数组 char string[80] = "Fill the string with something"; cout cout char *p=strcpy(string,"abc"); cout cout char str[80]; cout cin>>str; p=strcpy(string,str); cout cout //拷贝前5个字符到string中 cout cin>>str; cout p=strncpy(string,str,strlen(str)); cout cout }