I do not understand the concept of stringstream
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
#include <iostream>
#include <sstream>
using namespace std;
int main(){
string stringer = "234";
stringstream ss(stringer);
int i;
ss >> i;
cout << i + 1 << endl;
int inter = 1231232354;
stringstream num_str;
num_str << inter;
cout << num_str.str().substr(1,5) <<endl;
}
|
How does this convert an int to a string. What does stringstream do to allow this?
1 2
|
num_str << inter;
num_str.str()
|
Last edited on