c 2b 2b skip whitespace

Solutions on MaxInterview for c 2b 2b skip whitespace by the best coders in the world

showing results for - "c 2b 2b skip whitespace"
Flick
21 Feb 2017
1// skipws flag example
2#include <iostream>     // std::cout, std::skipws, std::noskipws
3#include <sstream>      // std::istringstream
4
5int main () {
6  char a, b, c;
7
8  std::istringstream iss ("  123");
9  iss >> std::skipws >> a >> b >> c;
10  std::cout << a << b << c << '\n';
11
12  iss.seekg(0);
13  iss >> std::noskipws >> a >> b >> c;
14  std::cout << a << b << c << '\n';
15  return 0;
16}