The thing is this, I am finishing my homework but my compiler cannot use to_string。I tried using std :: to run it, but it has no effect.Is have any code substitute to_string?
This is my code
string data2string(int data[], int size, int active_index)
{
string s = "[";
for(int i=0; i<size; ++i)
{
if(i==active_index)
s += "active="+ std::to_string(data[i])+", ";
else
s += std::to_string(data[i])+", ";
}
s += "]";
return s;
I use Code block 20.03, my teacher does not allow the use of other compilers.This is also a very funny thing. I followed my textbook, but the teacher ’s compiler does not support it.
size = 6
[11, 2355, 35, 47, 59, 611, ]
Program ended with exit code: 0
The additional function above is one way of going around the (well-known) problem of CodeBlocks and it's associated compilers that are out of date - all the more reason not to use it.
Google the problem if you want to go down the rabbit hole of getting a compiler that works with CodeBlocks.