我的代码是这个
#include <iostream>
#include <fstream>
using namespace std;
string mapChange(int side, string oldMap);
int main(){
string createMapName;
string createMapNameData [10];
int featureSelect;
cout << "(1)Game or (2)Mapmaker";
cin >> featureSelect;
if(featureSelect == 2)
{
cout << "Name of Map?";
cin >> createMapName;
ofstream mapName;
mapName.open (createMapName);
mapName << createMapNameData[0] << endl;
}
return 0;
}
string mapChange(int side, string oldMap){
string newMap;
if(oldMap == "Test")
{
cout << "Map Found :D";
}
else
{
cout << "ERROR MAP NOT FOUND, PLEASE REINSTALL.";
}
return newMap;
}
如何在第 15 行使用 c_str 插入字符串,即如何将字符串转换为 c_str()?请帮忙,利杰罗伯特