deceptikon, your method compiled just fine but didn't actually change the output of the number. If I entered 12345 it would still out put 12345 rather than 012345 which is what I'M trying to get.
Let's make something abundantly clear: the type of string matters. Are you using a C++ string object? In that case, my solution works:
#include <iostream>
#include <string>
using namespace std;
int main()
{
string s = "12345";
s = '0' + s;
cout << "'" << s << "'" << '\n';
}
If you're using a C-style string, which is nothing more than an array of char terminated by '\0', it's less intuitive, more awkward, and easier to get wrong:
#include <cstring>
#include <iostream>
using namespace std;
int main()
{
char s[10] = "12345";
// Shift everything to the right by 1 to make room at the front
memmove(s + 1, s, strlen(s) + 1);
// Prepend '0'
s[0] = '0';
cout << "'" << s << "'" << '\n';
}