大佬们帮指点下那个环节出了问题 编译不通过
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main(void)
{
vector<string> svec;
string str;
//输入vector元素
cout<<"Enter strings:(Ctrl+Z to end)"<<endl;
while(cin>>str)
svec.push_back(str);
//创建字符指针数组
char **parr=new char*[svec.size()];
//处理vector元素
size_t ix=0;
vector<string>::iterator iter=svec.begin();
for(;iter!=svec.end();iter++,ix++)
{
//创建字符数组
char *p=new char[(*iter).size()+1];
//复制vector元素的数据到字符数组
strcpy(p,(*iter).c_str());
//将指向该字符数组的指针插入到字符指针数组
parr[ix]=p;
}
//释放各个字符数组
for(ix=0;ix!=svec.size();ix++)
{
delete[]parr[ix];
}
delete[]parr;
return 0;
}
//错误提示
/*23 27 C:\Users\WP-S10\Desktop\练习\未命名9.cpp [Error] 'strcpy' was not declared in this scope*/