fork download
  1. #include <fstream>
  2. #include <string>
  3. #include <cctype>
  4. #include <iostream>
  5. // #include <boost/asio.hpp>
  6. #include <sstream>
  7. int main()
  8. {
  9. // ideone.com doesn't link with boost.asio
  10. // boost::asio::ip::tcp::iostream s("www.google.com", "http");
  11. // if(!s)
  12. // std::cout << "Could not connect to www.google.com\n";
  13. // s << "GET / HTTP/1.0\r\n"
  14. // << "Host: www.google.com\r\n"
  15. // << "Accept: */*\r\n"
  16. // << "Connection: close\r\n\r\n" ;
  17. //
  18.  
  19. std::string str = "2+2=4 and other character, including 100%";
  20. std::istringstream s(str);
  21.  
  22. // and does not access files
  23. // std::ofstream out("output.txt");
  24. for(char c; s.get(c); )
  25. {
  26. if(std::isdigit(c) || c == ',' || c == '-' || c == '%' || c == '.')
  27. std::cout.put(c);
  28. }
  29. }
Success #stdin #stdout 0s 2860KB
stdin
Standard input is empty
stdout
224,100%