fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Complex
  5. {
  6. public:
  7. double real;
  8. double imag;
  9.  
  10. friend istream& operator>>(istream& in, Complex& complex)
  11. {
  12. in >> complex.real;
  13. in >> complex.imag;
  14. }
  15.  
  16. friend ostream& operator<<(ostream& out, const Complex& complex)
  17. {
  18. out << complex.real;
  19. out << complex.imag;
  20. }
  21. };
  22.  
  23. int main() {
  24. // your code goes here
  25. Complex complex;
  26. cin >> complex;
  27. cout << complex;
  28. return 0;
  29. }
Success #stdin #stdout 0s 15240KB
stdin
1.5, 2.5
stdout
1.50