fork download
  1. #include <iostream>
  2.  
  3. struct MyClass {
  4. int i;
  5. std::string s;
  6. friend std::ostream& operator<< (std::ostream& os, MyClass& m) {
  7. os << "i = " << m.i << std::endl;
  8. os << "s = " << m.s << std::endl;
  9. return os;
  10. }
  11. };
  12.  
  13. int main() {
  14. // your code goes here
  15. MyClass m = {12345678, "Pinus"};
  16. std::cout << m << std::endl;
  17. return 0;
  18. }
Success #stdin #stdout 0s 3272KB
stdin
Standard input is empty
stdout
i = 12345678
s = Pinus