← Operator Overloading

Print a Point

medium

Define operator<< so std::cout << p prints Point2D p as (x, y). Write it as a free function, outside the class – exactly the lesson’s Vector2D example, applied to Point2D – taking the stream and the point as two explicit parameters, and returning the stream by reference so std::cout << p << std::endl; keeps chaining correctly.

Your solution

"Run" uses the sample stdin ("1 2"). "Submit" checks your code against all 3 test cases.

Test results

Submit your solution to run it against all test cases.

Hints

    Reference solution