I know this is extremely basic but I'm very new to C++ and can't seem to find an answer. I'm simply trying to convert a few integers to strings. This method works:
int a = 10;
stringstream ss;
ss << a;
string str = ss.str();
but when I need to convert the second and third ones like this:
int b = 13;
stringstream ss;
ss << a;
string str2 = ss.str();
int c = 15;
stringstream ss;
ss << b;
string str3 = ss.str();
I get this error:
'std::stringstream ss' previously declared here
Do I need to somehow close stringstream? I've noticed that if I put them far away from each other in my code the compiler doesn't mind but that doesn't seem like something I should do. Does anyone have suggestions?