VC大神来看一下: VC2010提示错误,提示“strcpy”: 不能将参数 2 从“char”转换为“const char *”
#include<iostream>#include<string.h>usingnamespacestd;intmain(){charfirstname[]="wang...
#include <iostream>
#include<string.h>
using namespace std;
int main()
{
char firstname[]="wang";
char middlename[]="a";
char lastname[]="li";
char fullname[10];
int offset;
strcpy(fullname,firstname);
offset=strlen(firstname);
strcpy(fullname+offset,' ');
offset++;
strcpy(fullname+offset,middlename);
offset+=strlen(middlename);
strcpy(fullname+offset,' ');
offset++;
strcpy(fullname+offset,lastname);
cout<<"the fullname is"<<fullname<<endl;
return 0;
} 展开
#include<string.h>
using namespace std;
int main()
{
char firstname[]="wang";
char middlename[]="a";
char lastname[]="li";
char fullname[10];
int offset;
strcpy(fullname,firstname);
offset=strlen(firstname);
strcpy(fullname+offset,' ');
offset++;
strcpy(fullname+offset,middlename);
offset+=strlen(middlename);
strcpy(fullname+offset,' ');
offset++;
strcpy(fullname+offset,lastname);
cout<<"the fullname is"<<fullname<<endl;
return 0;
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询