I'm having trouble concatenating a string with a double. It should work fine but it doesn't:
temp_equ is a string.. (a c++ string)Code:temp_equ = ( temp_ans + temp_equ.substr( op_indices[counter]+1 ) );
temp_ans is a double.
The weird thing is I created a test project and the following worked fine:
Which is virtually what I'm trying to do.Code:string s = 3.0 + "asdf"; and double x = 3; string s = x + "asdf";
In my real project I tried the following to make sure it wasn't something to do with the substring:
and I still get the following exception:Code:temp_equ = temp_ans + "asdf";
What exactly am I doing wrong? It works in another file doing the exact same thing, but not in another...Code:67 C:\Dev-Cpp\Projects\Equation Parser\main.cpp invalid operands of types `double' and `const char[5]' to binary `operator+'


Reply With Quote
