错误 2 error C2664: “strlen”: 不能将参数 1 从“char”转换为“const char *” 应该怎么改啊? 5
intmain(){stringstr;vector<string>svec;while(cin>>str)svec.push_back(str);char**parr=...
int main()
{
string str;
vector<string> svec;
while(cin>>str)
svec.push_back(str);
char **parr=new char*[svec.size()];
size_t ix=0;
for(vector<string>::iterator iter=svec.begin();iter!=svec.end();++iter,++ix)
{
char *p=new char[(*iter).size()+1];
strcpy(p,(*iter).c_str());
parr[ix]=p;
delete p;
}
for( ix=0;ix!=svec.size();++ix)
{
for(size_t j=0;j!=strlen(*parr[ix]);++j)<<<<<<<<<<---------------
{
cout<<**parr;
}
cout<<endl;
}
cout<<endl;
for(int i=0;i!=svec.size();++i)
delete[] parr[i];
delete[] parr;
return 0;
} 展开
{
string str;
vector<string> svec;
while(cin>>str)
svec.push_back(str);
char **parr=new char*[svec.size()];
size_t ix=0;
for(vector<string>::iterator iter=svec.begin();iter!=svec.end();++iter,++ix)
{
char *p=new char[(*iter).size()+1];
strcpy(p,(*iter).c_str());
parr[ix]=p;
delete p;
}
for( ix=0;ix!=svec.size();++ix)
{
for(size_t j=0;j!=strlen(*parr[ix]);++j)<<<<<<<<<<---------------
{
cout<<**parr;
}
cout<<endl;
}
cout<<endl;
for(int i=0;i!=svec.size();++i)
delete[] parr[i];
delete[] parr;
return 0;
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询