[求助]这段编程为什么错呢?
[求助]这段编程为什么错呢?我是用的VC++2005
#include <iostream>#include <cstring>
#include <string>
int main()
{
using namespace std;
char charr1[20];
char charr2[20]="jaguar";
string str1;
string str2="panther";
str1=str2;
?strcpy(charr1,charr2);
str1+="paste";
?strcat(charr1,"juice");
?int len1=str1.size();
?int len2=strlen(charr1);
cout<<"The string "<<str1<<" contains "<<len1<<" character.\n";
cout<<"The string "<<charr1<<" contains "<<len2<<" character.\n";
return 0;
}
警告 1 warning C4996: “strcpy”被声明为否决的 e:\microsoft visual studio 2005 简体中文专业版\vc++2005\项目\4.9\4.9\strtype3.cpp 12
警告 2 warning C4996: “strcat”被声明为否决的 e:\microsoft visual studio 2005 简体中文专业版\vc++2005\项目\4.9\4.9\strtype3.cpp 14
警
告 3 warning C4267: “初始化”:
从“size_t”转换到“int”,可能丢失数据 e:\microsoft visual studio 2005
简体中文专业版\vc++2005\项目\4.9\4.9\strtype3.cpp 15
警告 4 warning
C4267: “初始化”: 从“size_t”转换到“int”,可能丢失数据 e:\microsoft visual studio
2005 简体中文专业版\vc++2005\项目\4.9\4.9\strtype3.cpp 16
请各位大哥指点!!!
[此贴子已经被作者于2007-5-23 17:22:19编辑过]