istringstream
The std::istringstream is a string class object which is used to stream the
string into different variables and similarly files can be stream into strings.
Objects of this class use a string buffer that contains a sequence of characters.
This sequence of characters can be accessed as a string object.
// C++ program to illustrate std::istringstream
#include <iostream>
#include <sstream>
#include <string>
using std::istringstream;
using std::string;
using std::cout;
int main()
{
// Input string
string a("1 2 3");
// Object class of istringstream
istringstream my_stream(a);
// Variable to store number n
int n;
// Stream a number till white space is encountered
my_stream >> n;
cout << n << "\n";
}