T
thomas
// ws manipulator example
#include <iostream>
#include <sstream>
using namespace std;
int main () {
char a[10], b[10], c[10];
istringstream iss (" one \n \t two");
iss >> noskipws;
iss >> a >> skipws >> b >> c;
cout << a << "," << b <<"."<<c<< endl;
return 0;
}
----------------------------
I expected the above code will output " ,one.two",
but it is ",."
I think a=" "; -> noskipws
b="one"; --> skipws
c="two"; --> skipws
Anything I missed?
#include <iostream>
#include <sstream>
using namespace std;
int main () {
char a[10], b[10], c[10];
istringstream iss (" one \n \t two");
iss >> noskipws;
iss >> a >> skipws >> b >> c;
cout << a << "," << b <<"."<<c<< endl;
return 0;
}
----------------------------
I expected the above code will output " ,one.two",
but it is ",."
I think a=" "; -> noskipws
b="one"; --> skipws
c="two"; --> skipws
Anything I missed?