fork download
  1. #include <iostream>
  2. #include <sstream>
  3.  
  4. int main()
  5. {
  6. for (char ch = 'a'; ch < 'z'; ++ch)
  7. {
  8. std::istringstream is(std::string("2") + ch);
  9.  
  10. double val;
  11. is >> val;
  12.  
  13. std::cout << "For \"" << is.str() << "\" val = " << val;
  14. std::cout << ", buffer = " << is.rdbuf() ;
  15.  
  16. if (!std::cout)
  17. std::cout.clear();
  18.  
  19. std::cout << '\n';
  20. }
  21. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
For "2a" val = 2, buffer = a
For "2b" val = 2, buffer = b
For "2c" val = 2, buffer = c
For "2d" val = 2, buffer = d
For "2e" val = 0, buffer = 
For "2f" val = 2, buffer = f
For "2g" val = 2, buffer = g
For "2h" val = 2, buffer = h
For "2i" val = 2, buffer = i
For "2j" val = 2, buffer = j
For "2k" val = 2, buffer = k
For "2l" val = 2, buffer = l
For "2m" val = 2, buffer = m
For "2n" val = 2, buffer = n
For "2o" val = 2, buffer = o
For "2p" val = 2, buffer = p
For "2q" val = 2, buffer = q
For "2r" val = 2, buffer = r
For "2s" val = 2, buffer = s
For "2t" val = 2, buffer = t
For "2u" val = 2, buffer = u
For "2v" val = 2, buffer = v
For "2w" val = 2, buffer = w
For "2x" val = 2, buffer = x
For "2y" val = 2, buffer = y