fork download
  1. #include <iostream>
  2.  
  3. struct A {
  4. A(int _a, double _b, char _c)
  5. {
  6. a = _a;
  7. b = _b;
  8. c = _c;
  9. }
  10. int a;
  11. double b;
  12. char c;
  13. };
  14.  
  15. std::ostream& operator<<(std::ostream& os, const A& a)
  16. {
  17. os << a.a << ' ' << a.b << ' ' << a.c;
  18. return os;
  19. }
  20.  
  21. int
  22. main()
  23. {
  24. A a{1, 3.2, 'c'};
  25. std::cout << a;
  26. }
  27.  
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
1 3.2 c