If you are going to find him, he is likely to be part of another addiction. Therefore, it is best to try to write your own. Now is the time to practice creating a class template. :)
template <typename T> struct point { // or maybe you'd prefer to make these private T x; T y; }; template <typename T> struct rectangle { public: typedef point<T> point_type; bool contains(const point_type& pPoint) { return !(pPoint.x < topleft.x) && (pPoint.x < bottomright.x) && !(pPoint.y < topleft.y) && (pPoint.y < bottomright.y); } T width(void) const { return bottomright.x - topleft.x; } // and more stuff // or maybe you'd prefer to make these private, nor // is this the only way to represent a rectangle. point_type topleft; point_type bottomright; };
Sorry, this is not the answer you expect.
As for your design, I hope you donβt take the GUI version, make a copy, and then modify it to the console version. It would be better to make a library; then the GUI and the console are just a matter of presentation.
source share