Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a an object to implement a point class which allows a programmer to store an x, y coordinate pair. It should have at least
Create a an object to implement a point class which allows a programmer to store an x, y coordinate pair. It should have at least two constructors, a set function, get functions for x and y, and overloaded I/O (cin/cout) functions.
Using C++ and the code given below
#includeusing namespace std; // We have setup class framework for you. // Please add cin/cout overload first and at the same time add the coordinates // // See github example as specified in the assignment handout for exaamples // class Point { public: friend istream& operator>>(istream &input, Point &p ) { // Finish me second by adding proper input >> statement return input; } friend ostream& operator<<(ostream &output, const Point &p ) { // Finish me thrid by adding proper output << statement return output; } // Please add constructors and other functions here. private: // Add me first }; int main() { Point P1; cout << "Enter P1: "; cin >> P1; cout << "P1: "; cout << P1; cout << endl; return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started