fork download
  1. #include <iostream>
  2. #include <sstream>
  3. #include <string>
  4.  
  5. int main()
  6. {
  7. std::istringstream stm( "A: 10\n"
  8. "B: 20\n"
  9. "C: 30\n" ) ;
  10.  
  11. std::string text ;
  12. int number ;
  13. while( stm >> text >> number ) std::cout << number << '\n' ;
  14. }
  15.  
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
10
20
30