Sale!

CECS 275 Lab 4 solved

Original price was: $35.00.Current price is: $35.00. $21.00

Category: You will receive a download link of the .ZIP file upon Payment

Description

5/5 - (1 vote)

Using the Point class below, create these overloaded operators for it.

<<, >>, +, -, ==,!=.

class Point {

int x, y;

public:

 

Point(int xp, int yp){

x = xp;

y = yp;

}

 

Point(){}

 

void Print(){

cout << ‘(‘<<x<<‘,'<<y<<‘)’;

}

 

};

You code them directly in the class declaration.

<< is insertion, >> is extraction, + means add the two x values and the two y values and return them in a new Point, – means subtract the parameter x from this x, and the parameter y from this y, and return the difference in a new Point, == is a member-wise comparison for equality and != is its opposite.