I am getting errors when I'm trying the following:
instantiateVariable(string startingExpr, char var_, int val_)
{
int sizeArray = startingExpr.length();
//Convert the int into a char/string
int number = val_;
string newChar = "";
ostringstream temp;
temp << val_;
newChar = temp.str();
//Searching for the variable in the array
for(int i = 0; i < sizeArray; i++)
{
//If the variable is in the string
if(startingExpr[i] == var_)
{
//"Replace" the char with the converted int in the string
startingExpr[i] = newChar;
}
}
}
The error says the following:
error: cannot convert 'std::string {aka std::basic_string<char>}' to 'char' in assignment
If anyone can tell me how to fix this I will REALLY appreciate it!
Thanks. :)