#include <iostream>
using std::cout;
using std::endl;
#include <string>
using std::string;
#include <sstream>
using std::istringstream;
int main()
{
string input( "Input test 123 4.7 A" );
istringstream inputString( input );
string string1;
string string2;
int integer;
double double1;
char character;
inputString >> string1 >> string2 >> integer >> double1 >> character;
cout << "\nstring1: " << string1
<< "\nstring2: " << string2 << "\n int: " << integer
<< "\ndouble: " << double1 << "\n char: " << character;
return 0;
}
|