c++ cin<< string数组问题

2024-11-28 10:45:32
推荐回答(1个)
回答1:

char *vname = (char*)malloc(vertexNum*sizeof(char));//这里把string改为char试试
for (int i=0 ;i {
cout << " 请输入编号为" << i << "的景点名称:";
getline(cin , vname[i]);
}