Integer to String conversion

I need alternative of this code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <string>
#include <iostream>
# include <sstream>
using namespace std;
int main()
{
int input =1999999998;
stringstream sso;
sso<<input;
string strinput;
sso>>strinput;
cout << strinput<<endl;
for ( int i=0;i<=strinput.length();i++)
{
	strinput[i]=strinput[i+1];
}
cout << strinput;
return 0;
}
What kind of alternative?
Maybe like that?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <string>
#include <iostream>

using namespace std;

int main()
{
int input =1999999998;
string strinput = to_string(input);
cout << strinput<<endl;
strinput = strinput.substr(1);
cout << strinput;
return 0;
}
Topic archived. No new replies allowed.