fork download
  1. #include <iostream>
  2.  
  3. struct CinProxy {
  4. template <typename T>
  5. operator T() const {
  6. T t;
  7. std::cin >> t;
  8. return t;
  9. }
  10. };
  11.  
  12. CinProxy get() {
  13. return {};
  14. }
  15.  
  16. void f(int i) {
  17. std::cout << i << std::endl;
  18. }
  19.  
  20. void g(std::string s) {
  21. std::cout << s << std::endl;
  22. }
  23.  
  24. int main() {
  25. f(get());
  26. g(get());
  27. return 0;
  28. }
  29.  
Success #stdin #stdout 0s 3464KB
stdin
123
foobar
stdout
123
foobar