0 like 0 dislike
705 views

Exercise 1

Using the file point.cpp (Click to download), add a member function print to the class Point so that it prints out coordinates as:

	(2, 3)

for a point with coordinates (2, 3). Test it in main().

Exercise 2

Write a definition of a class Rectangle using the Point class. A rectangle is specified by two corner points (bottom left and top right). The sides of the rectangle are parallel to the coordinate axes. The implementation of the class should be as follows: 

  • The private data members of the class include all 4 corner points of the rectangle.
  • There are two constructors: one takes two points as arguments and creates a rectangle with the first point as the bottom left corner and the second as the top right corner, the other (default) constructor creates a rectangle with the corners (0,0), (1,0), (0,1), (1,1). 
    Hint: use functions Set_X, Set_Y from the class Point to set the values of the corner points.
  • The print member function prints all 4 corners of the rectangle, using the member function print of the class Point.

Test the class Rectangle in main(), demonstrate that all member functions work as specified.

[Exercise] Essay (Open question) - asked in C++
ID: 24536 - Available when: Unlimited - Due to: Unlimited
| 705 views
0 0
Called for Help
0 0
Called for Help
0 0
Called for Help

20 Answers

0 like 0 dislike
Hidden content!
** ** * * * * ** using ** std; int main() { int * * for(int i=0; i * * i++) { ** *** num[i]; } * *** ****** * { * ** * *** * ****** *** * * * ** * * * * * * * **** * * * ** *** * } else{ *** *** * * *** ** *** *** ** * ** * * * **** * ********** ** * *** } return 0; }
answered by (126 points)
0 like 0 dislike
Hidden content!
// file ** * *

// used as part of lab

// * * * *** * Point

// * *** ** ** ** ** * to * * * ** *

// * * * ** * **** ** to test *


* *** * ** * **** **



// * * * * **** ** * ** *** * * * *******

// * ** * of Point

// * ** * **** ** **** * * * ** ** * **



// * * * ** a * * * **
**** ***

{

*** * *** * * class ** * * * no *******
* * * * ** **


** ** * * class *** ** that sets the * * * x, y to the * * *
** ** * * **
* ** *** ***** xval, int *


* ** * ** for * * a point by dx, dy:
* * * dx, int dy);


*** ** ** * ** ** * for * ** * of x, y:
* ** **** **** ** * * *
*** * ** * **** ** *


* ***** **** * ** * for x, y to xval, yval * * * *
** **** * ** *** * *
* * * * * * * ***** **


* *** 1. Add * *** * of * * *** Print here:
** ** ** * ** * *



// * * * data ** x, y * *** *** ** of the * *
** *
** ** * X;
**** * * **** Y;

};



// * * * ***** * ** **** * ***

// *** ** for class * ***

// *** * *** * ** * ** *** ** * ***



// class ** *** * sets X, Y to zero when no ** are * ** * *
* * * *

{
** * **** = 0;
** * ** * = 0;

}



// class ** ** sets X, Y to given ** * xval, yval:
**** ** * xval, int yval)

{
* * * * * = xval;
** * * = **

}



// * * * ** *** the x ** by dx and the y

// * * * by dy.

void **** * * dx, int dy)

{
**** *** * * * += dx;
* * * += dy;

}



// ** *** * the ** of the X * *

int * ** **

{
** * *** * * X;

}



// Get_Y ** * the value of the Y **** ***

int * *** * **

{
* ** * ** **** Y;

}



// * sets the ** of X *** * to xval
* * ** ******* *

{
* * * ** *** * = * **

}



// Set_Y sets the value of Y ** to yval

void **** ** yval)

{
** * * * * = yval;

}


* * * 1. Add of **** ******
** * * **

{
*** ** * ** *** * * ** ** * * * * * * * ** * *** *** * * ** ** * ** * ** * * * ** **** **** **** * * * *** * ** * **** *

}



// *** * * ** * **** * ** ****** ***

// ** * * * of * * ***

// *** * * ** *** ***** * * *** *** ** ** ***


* *** ****** 2: Add *** ** ** * **** ** *
** * * *
* ***
** ** ** * **** *** *
**** **** * ****** ** ** ** * * *
* * ** ** *** * *** * * *
* *
*** ** * ** * x1; int x2; int x3; int x4; int y1; int y2; int y3; int y4; * * p1; * p2; ** p3; ** * p4;

};

// * ** * ** ** ** * * *** *

// ***** * *** for * *

// *** *** ** ** * * *** ** ** *
* 2. Add * ** * ** **


****



// * * *** * ** ** ***** ** * * *

// * *** * for * ** ** ***** and * *

// * ** *** * * * * * * *** * * **
****** ** *

{
***** * * *** * *** *** = 0; y1 = 0; x2 = 1; y2 = 0; x3 = 0; y3 = 1; x4 = 1; y4 = 1;
* * * * * * * * * * * * * * ** * **** * **
* * **** ** * ** *** * * ** * ** ** * * *
* *********** * * * * *** * * ** ** ** *
**** ** * * * **** * ******** ******

}


** ** * ******* *** **** ** * * ***

{
* * ** * *** * ** * = * * y1 = ***** * x4 = * * y4 = * *
*** * * **** **** * * * * * = x4; y2 = y1;
** ** * *** ***** * = x1; y3 = y4;
*** * * * * ***** * * *** * * ****
*** ** * ** **** *** * * ***** *****
* * * ** * ** ** ** * * *** ** *
* ** ***** * ** * * ** *** * * *** *

}


** ** * * *

{
* ** ** ** * ** * ******* * * * *** ** **

}

// * * * ** and * ***

int *

{
* * * *** * * * *** * * * a * * ** *** * ** (x = y = 0):
* * ********** ****** ** p1;
* * * * ** ** * *** *** ** * ** *** x for p1 is **** ** ***** * ** * **** ** * **
** * **** *** ** * * ***** * ** * * * * y ** for p1 is * * *** * * * ** * * * ** ** * * **


** * **** * * * ****** * * * a * with * X = 2, Y = 3:
* *** * **** * * ** * ** 3);
* ** ** ** **** ** *** *** * * * * x ** for p2 is * * * * * ** * * ** **** * ** ** *
**** * **** ** ** * **** * * * * ** y ** for p2 is * * * * * ** * ** *** ******** * *


** * * * ** *** * ** * * * * * p2 by (1, -1):
** * ** ** ** *** ** * -1);
*** ***** * * ** ** ** ***** * ** ****** the ** ***** * ** ** * ** ** *****
* *** *** ** ** * * ******** ** ** * x * for p2 is * * * **** **** * *** *** ** *** *
* * * ** * * ** * * ***** * * ** * * ** y * for p2 is *** ******* * * * * ** * * ** **


* * ** * *** *** * * ****** * ** * * ** * 1. Test * ** * *** on * p1, p2:
* * * **** *** * ** * * **
** ** * ***** *** ** * ** * * * * *** * ***** *
** * ******* **** * ** *
* * * * * ** ****** * *** * * 2. * of the * * ** goes *


* **** *** ** ** * ** ** * r1;
* *** ** * ** * * *** **** ** * ****** ** ** * for r1 is * * * * * ** * ** ***
** **** * * **** ** *** ** ** *


***** *** ** * ** ** * * ** * * * ****
* ** ***** * ** *** * * ** *
** * ** ** *** ** * * *** * ** * * ***** * * for r2 is * * * ** **
* ** *** ***** ** * * **


* ** ** * ****** * 0;

}


*** ** * ** * * * * * ** * ******
answered by (-368 points)
0 like 0 dislike
Hidden content!
* * * ***
* *
{
**
*** *
* * *** ** ** *
* ** * *** *
*** **
* * * *
** * * **
* ** * **
*
* * * **

*

* * *
{
** * ******* **** *** * * * *** * *** ** * ** * ** ** * ***
}
*** * *
{
X =
Y = *
}
* **** * *** * * *
{
*
* * * *

* * ** * ** **

**
*

* ** * * *

* ** *

* ** * *

* * *
*
* ** **** * *

X = **
}
* * ** * ** *
{
Y = **
}
* **
{
* *
* * **
*** *
** *
*** * *
**
* ** *
* **
***

**** * ** ** *
{
*
** * *
* * **
*** ***
*
* * * *
** **
******
}
** * * * ***** * * **
{
** * * **
***** *
*** *
** ** * ***
** ** ** * *
* * *
*** *
*** * *
*
*** *** * * ***
{
*
** *
**
* **
*
** **
{
** *
* * *** * **** x ** ** * * * *** * * ** * *** ** **
* * ** ** **** * y * ** ** * * * * * *** * *****
* * **
** * * * * x **** **** * *** *** **** * ** * *
* ******** * * y * * * ** **** ** * ** ***** * ** ** ** *** *
***** **
** * * * ** * *** * * *** ** * * * *****
* ** * *** ** *** * * * * * * ** *** *** * ******* ** *** ***
* * * ** ** **** ** * * * * * ** *** *** * ** ***** *
* * ****
** * ** ****** ** * * ***
****
* * *
* * * * ** *** * * * * ** * **
***** *
*** * *
* * ****
*** **** * * ** * * * *** * * **
** *
**** *
}
answered by (-367 points)
0 like 0 dislike
Hidden content!
** *** * * * * ** ** *** * * * ****
answered by (-581 points)
0 like 0 dislike
Hidden content!
** ** * * ** ** * *** ** ** * *** **
answered by (-189 points)
0 like 0 dislike
Hidden content!
** * * *** **** * ** *** ** ** *** *** *
answered by (-364 points)
0 like 0 dislike
Hidden content!
* ** ** * * * * ** * * * *** ****
answered by (-384 points)
0 like 0 dislike
Hidden content!
* ** * * ** ** * ** * ** * ***

// Name ** **** * ***** *** ** **** *** * * *

// Author * ** ** * **** * ** **

// Version * ** * * * * * * ***

// *** * ** Your * * notice

// ** ** : Hello World in C++, ** ***
* ****** ** * *** **** **** ** ****** * * *


* ** * ** **** *******
**** ** * *** ***

using * * ** std;

// file **

// used as part of Classes lab

// * ** ** Point

// ** * *** ** * to insert class *** *

// * * *** * * * *** to test classes



// ** * * ** *** **** ********** ***********

// *** **** of class Point

// ** * * **** ** *** * * * * * ** ***



// class Point ** * a ***** * point

class Point

{

public:
** * * *** ** default class * * (with no ** * *
* * *** **


* ** * * * ** class * * * * that sets the *** * x, y to the values xval,
** * **** yval:
** ** * ** xval, int yval);


*** * **** *** member ** for moving a point by dx, dy:
* **** * * *** * * dx, int dy);


* * * * ** member ***** for getting values of x, y:
* *** * * ** * Get_X() const;
* *** * * ** ** Get_Y() const;


* * member * for setting x, y to xval, yval * ** *
* ** ** *** * * * xval);
** * * ** *** yval);



//Lab ** * 1. Add ** * * of member *** *** Print here:
* * * * * * *



// private data members x, y * * * * of the point:
** * **
* ******* **** X;
* **** ** * Y;

};



// * * * * ** **** ****** * * * * * **

// ** * for class Point

// ** ** * ****** ** *** ** ** * * * **** * **



// class * sets X, Y to zero when no values are * * *
** * *

{
* *** *** = 0;
* ** ** = 0;

}



// class * * * sets X, Y to given values xval, yval:
* * * * xval, int yval)

{
* ** = xval;
* * ***** = yval;

}



// member ** * Move: *** the x *** ** by dx and the y

// * ** * by dy.

void * * dx, int dy)

{
** ** ** * ** += dx;
* **** *** += dy;

}



// Get_X returns the value of the X *

int *** * const

{
* * *** ** X;

}



// Get_Y returns the value of the Y *** ***

int ** **** * * const

{
* *** **** **** Y;

}



// Set_X sets the value of X * ** to xval

void *** * xval)

{
*** * * ** = xval;

}



// Set_Y sets the value of Y * * to yval

void ***** ** ** yval)

{
* * * * * * * = yval;

}



//Lab *** 1. Add * * of member *** print:

void ***** **

{
** * * * * ** **** ***** **** ** ** * * * *** ** ** * * ** X ** * * * * ***** * * * * * * * Y *** *** **** * *** * *

}



// * * ** * ** * ** **** * **

// *** **** ** * of class

// ** ** **** ** * *** ******* *** *



//Lab ** 2: Add class ** *** * HERE:

class * ** *

{
* ** *
** * * *** *** * ** * **
* ** * ***** ** * * * * *
*
*** **** * ** **** ** * ** * *
* ** *** **** ** ** * * x,Point y);
** ** ** * *** * ***** *** ** Print();



};



// ** ** ** * * * * ***** *** ****** *

// ** *** * for class *

// ** ** ***** * * ** ** ***** ** * * *



//Lab 2. Add class * * * methods HERE:
* ** * * *

{
* ** **** * *** * * *
** ** *** * * ****
* * * ** ** * * ***** * ***
* * ** * * ** ***** * ****
*** ** * * *** *** *
* ** * *** * * ** *** *
* **** * * **** **** *
* * ****** *** *
**** * ** * * **** **
** * * ** *** *** * ***
** * * * * * * ** ** *
****** * * * * * * ** ****
* ** * * * ** *** **

}
** ** * * * * * a2)

{
** * * *** ** * *** * ** ** *
* * *** * * * * ** * *** *
* * *** *** * *** ********** * * * ***** ** * **
* ***** * ** *** * *** * *** *
*** * ***** ***** **** * *
** * * * * ** * **** * ** * * ** * * * *
* ** * *** ** **** ** * *****
* * *** ** * * ** *** * * * * **
***** * ***** *** ** ** * **
** * * * * * ** *** *** *** *


* * **** ** ***** ** * ** * * ***
* ** * * *** ** *
** * * ** **** *** * * *** *** * *** *** **
*** * * * ** * * ** *** ** * ** ****** ** *** * * * *****
* * ** ** * ** * ** ** ********* ** *
**** * ** * ***** * **** ** *** **** * * ** *** ** **
** * ** ** **** ** *
*** ***** ** * * * ** *** **
*** * ** ******* *** **
* ** * ** * * * **** ** *** * ***** ****** ** *** * ** *
***** ** ** * * * *** * * * ****** * * * ** **
** *** * *** *** ** * * ** *** *** * ** * *
* * * * ** ** * ** * * * *** ** ******** * *** * *** ** *
** ** * * **** * * ****



}
* ** ** ****

{
** ** ** * *** * * * * * * *** * *** * * ** n1[0] ** ****** ** * ** * ***** * * n1[1] * *** * * ** * * * **
* ** * **** * * * **** ** ** ** ** ** * n2[0] ** * ** * **** * ** * n2[1] * * * * ** * * * * * *
** *** ** * *** ** * * * ** * * ** * *** * * n3[0] *** * * ** *** * * * *** **** * ** n3[1] * **** * *** * * * ** ** * * *****
*** * * *** * *** *** * *** *** *** * ** * n4[0] * *** * **** ****** ******* *** n4[1] ** **** * * *** ** * *** * *

}



// **** ** * * ** * * * * ** ** * ** *** *** **

// ** **** * * for testing classes Point and *

// * **** ** *** ** * ** *** ** *


* * **



// Testing classes Point and *

int main()

{
** ***** *** *** ** ** ** ** * a point using default class ** * ** (x = y = 0):
** ** ** *** ** ** *** * ** p1;
** ** ** * **** * * ** * * ** * *** ** ** x value for p1 is * * **** *** *** * * **** *** * * *
** ***** * * *** * * * * y value for p1 is *** ** * *** ** * * *** * ** ***


****** * ** ** ** ** ** a point with * * * X = 2, Y = 3:
** * **** **** ** *** * * p2(2, 3);
**** * **** * *** * *** ** *** **** ** x value for p2 is *** * * * ** ** * * * * ** *** *
** ******** * ** * ** * * ** * * ** * * ** y value for p2 is * * * *** * * * *** * * * **** * * * **


** * **** ** * ** * * Moving point p2 by (1, -1):
** * *** ***** *** *** ***** * * -1);
* * * * * * * * *** ** * * *** * * * *** * the *** ** * * * * * * * **
*** * ** *** * *** * * * * * ** * * * x value for p2 is * ** ** * * *** * ** ** *
* * ** * ** ***** ** * ***** * ** *** * ** y value for p2 is * *** ** * * * * * ** *


**** * ** * * * * * * ***** 1. Test member **** print on points p1, p2:
* *** * *** ** ** * ** ***
* **** *** * **** ** *** **** *** *
** ** **** ** *** ** ***
* * * * * * * * * ** ** * **** 2. Testing of the class **** goes here:


* * ** *** * ** **** r1;
** ** * * *** *** * ** ** *** ** * * * values for r1 is * * * ** *
** *** * ** * * ** ** * *


* ** *** *** *** * * ** ** * * * * * **** ***
** *** ** **** * * * * * *
* * **** * **** *** * ** * ***** ** values for r2 is * * **** * *
* *** *** ** ** * *** **


* ** *** * ** * *** * * ** 0;

}


** * * * ***** * * * ** *
answered by (0 points)
0 like 0 dislike
Hidden content!
// file ** *

// used as part of * lab

// * ** ** **** Point

// ** **** * *** * ** to * *** * **

// ** * * *** ** to test **


* * ** ** **


* * * std;



// * * *** ** * *** * *** ** ** * ****

// * * * * * of *** Point

// ***** * ** * ** *** * * ** * * * *



// *** ** ** * a * * * *
* *

{
* *
* * ** * **** class * ** (with no * ** *
** * * * *


* * ** ** class ***** * that sets the * ** * x, y to the * * xval,
******* **** yval:
** * *** * * **** xval, int


* * * * * * * ** *** * * * for ** a point by dx, dy:
** ** * ** ****** dx, int dy);


**** * * ** for * ** *** of x, y:
* ** ** *** * ** ** * **
** * ** * *** *


***** * ** *** * * for * * ** x, y to xval, yval ****
* * ***** ** * * **** ** *
* ** **** * * * **


* ** 1. Add * * * of * * * * Print here:
* * * * ** * *



// * data ** x, y *** * * * * ** of the * *
*
*** * * * X;
*** * Y;

};



// *** *** * * ** *** * * * *** **

// ** *** for class Point

// * ** *** ** * ** * ** * ** ***



// class * **** sets X, Y to zero when no * ** * are *
* **

{
**** ** ** *** = 0;
* **** ** * = 0;

}



// class * ** * sets X, Y to given ** xval, yval:
* ** * xval, int yval)

{
* ** *** * = xval;
* * * ** * * ** = yval;

}



// * ** * * Move: *** the x *** by dx and the y

// * * * by dy.

void * * ** dx, int dy)

{
* * **** ** += dx;
* * * *** += dy;

}



// Get_X *** the value of the X * *

int * ** * const

{
* ** ** ** ** X;

}



// Get_Y * the value of the Y ** *

int *** const

{
* **** **** *** Y;

}



// Set_X sets the value of X ** * to xval

void *** * ** * xval)

{
** * *** * * = xval;

}



// Set_Y sets the value of Y ** * * to yval

void ** * ** * yval)

{
***** *** = yval;

}



void * * *** *

{
*** ****** * **** * * ** * ** * ** * ** * X ** * ** *** **** ** ** * ** * Y *** *** ***** ** * * * *

}
* * 1. Add * * of ** *** *****


* * *** *

{
** **
** ***** * * * * * *** * ** *
** * *** * * *** xval, Point *
** ** ** * ** * ** * ** ** **


* ***
* ** ** **** * * * * * p1;
* *** * **** * **** * * ***** * p2;
*** * ***** *** * * p3;
* ** * ** * ** *** * * * p4;



};
* * * *** * ****

{
* * ***** * * *** *
** *** *** * *** * *
* ** ** *** *** ** * * * * *
**** **** * * ** * ** *** *



}
* ** *** ** * * Point yval)

{
* ******* * ** ** **
* *** ** ** * **
* ** ** *** * *
** ** *** *** ***
** * ** **** ** ** *** *** **
** ** * ** ** * * *
* * * **** ** ****
* *** ******* * ** *******



}
**** * ** ***

{
* *** *** * **
* * * *
** * * ****
** * * *** *** * ***
* ** * * ******** **
* * ***** * * **
* **** * **** * *
** ** * ** ** * ***



}



// **** *** ****** * ** *** * * **

// *** * * * of ** ***

// * * *** ***** * **


* ** 2: Add ** ** * * ** HERE:



// * * **** **** **** ****** ******* * ** *** **

// **** *** for class * *

// * *** * * ******* **** * ** ** *


* * * 2. Add * * *** ***


*** **



// * * * **** ** ** **** * ***** *

// *** * * for * * * Point and * **

// ** **** * * *** * ******* ******* *


* * *



// **** * ** Point and ** ***

int ** *

{
* *** * * * *** ** *** a point using ** * * ***** (x = y = 0):
* ** **** * ** **** *** * ** ****** p1;
* ** * * * *** * *** **** ** ** * * * * * * x * for p1 is *** * * *** * ** * * * * * * ** ** ** *
* *** * ** ****** * *** * * * * * * * * * y for p1 is * * * **** ** * * ** * * *** **


***** *** ** * * ** ** a ** with *** * X = 2, Y = 3:
*** * * ******** * ** * ** ** ** 3);
** ** *** * * * *** ** ** *** * *** ** x ** for p2 is * * * * * * ** ** * ** *** * ** * **
**** * * * * **** * ** * ** **** * ** y ** for p2 is ** ** * ***** * ** * * *** *


** * ** * ** * ** ** p2 by (1, -1):
* * ** ** * *** * * * * -1);
** ** ** * * ** ***** * ** * * ***** the * * ** * * * * *
** ** ********** ** * * ** ** * * * ** * * ** * x for p2 is ** * * ** * ** * * * * * *
* * **** *** ***** * * * ***** * * * *** y ** * for p2 is **** * * *** * * * * ** * ** *


* *** *** **** ** *** * 1. Test * ** * **** on * * p1, p2:
* * *** * * * * ** * * ** ***** *
* * ********** *** * * * * ** ** **
*** **** ** * **** **
* *** * ***** * ** ** *** * *** 2. *** of the * *** goes **


**** ** * ** * ** *** * * r1;
* ** ** ** *** * * * **** *** * *** *** ** ** * * for r1 is ** * * * ** *
* ** * ** ***** * ***


** * * * ** * * * * * * * *
********* * * ** **** *** * * * *
** * ** * * * **** ********** * * ** ** ***** for r2 is * * *** * ** * ** *
* * ** * ** *** * ** ***


*** * * ** * ** * * * ** 0;

}


** ** ** ** ** ** * * *** ** * **** *
answered by (-364 points)
0 like 0 dislike
Hidden content!
// file * *

// used as part of ** lab

// ** * * * * Point

// * ******* ** ** to * * class * *

// * * ** *** * * * * * to test ***


* * * * **


* * std;

// * *** * * * ** ** * ** * * **

// * *** * * of class Point

// *** * *** * * *** * ** * * * **



// *** Point * a ** * *** * point
* Point

{
*****
** ***** * * * class * * (with no ****
*** * * * **


** * * class * ** * that sets the * * x, y to the *** xval,
* * ** *** ** yval:
* * ** ** * * xval, int *


* * * ** * * * *** for * * a point by dx, dy:
***** ** * * dx, int dy);


* * * * * * * for * ** of x, y:
** * * * * * * **
* * * *** * * * *


* * * *** ** **** for * * x, y to xval, yval ** *
* * * * * *
* ******** ** * * ** *


* ** ** * * * * *


** *** 1. Add * of * *** ** Print here:



// ** data *** x, y ** *** ** of the *
** *
**** * ** ** *** X;
* * ** ** Y;

};



// * * * ** ** * ** * * **** ****

// ** * * for class Point

// *** *** * * * ** **** ** ** ** * **



// class * ** ** sets X, Y to zero when no * are ** *
** * *

{
* * * ***** = 0;
* ** * *** = 0;

}



// class **** * sets X, Y to given **** xval, yval:
* * * *** xval, int yval)

{
*** ** ** * = xval;
** ** * * **** * = yval;

}



// * * Move: ** * the x * *** by dx and the y

// **** ** by dy.

void * * ** * dx, int dy)

{
** * * * * += dx;
*** * * += dy;

}



// Get_X *** the value of the X * * *

int * *** ** const

{
* ******* X;

}



// Get_Y ** * the value of the Y *****

int * ** * * const

{
* * * * * Y;

}



// Set_X sets the value of X ** * to xval

void *** ** xval)

{
* **** * = xval;

}



// Set_Y sets the value of Y *** ** to yval

void * ** * * yval)

{
* ** * ** ** * **** = yval;

}


*** * ***

{
* * * ***** * * ******** ***** ** * * * * * *** X * ** ** ** ** ***** ** * ** Y ** *** ** ***** * * * ** endl;

}


* * 1. Add * * of * *** **



// * * ****** * * ** ** ** ** * * *

// ****** ** of class * ** ***

// * ** *** **** ** **** * **** *****


* * * 2: Add class *** * * **** HERE:


* * * *

{
** ** * * * **
** * ****** * **** ** * * * * ** ** *** * **
*** * * * ** ** ** * * ** ****** * * * ** ** * Point * *
* ***** ******** * * * ** ******


* * * * * * * * *
**** * ** **** ** * *** BL;
** *** *** * *** *** * BR;
* * *** ** * * * * * ** TL;
*** * * * ** *** * ** TR;

};



// **** *** * * * * * *** * *

// ** *** * for class **

// ********** * *** * * ** * ******


*** ** * 2. Add class ** ** * **


* * **

{
*** * *** ** * ***** **
* ** **** *** * * * * *** **
* * ** *** ** * * * * *
* ** **** ** * ** * **** *** ***
** ** ** * * * * ** * * * * *
** * *** ** ** ** * ** *** *** **
* * ******* *** ****** *** * *
* * * * ** **** * * ** **

}


* * ***** * **** Point **

{
* ** * **** *** * * * *** * * *
* * *** * ***** * **** ***** * *
* *** * * *** *
*** * ** * * * *** ** * * ** * *
** * * * *** * ***** * * *
* * *** ** *** * **** * ** *** * **
**** ****** ** * *** ** ** ****
* * * * ****** ** * * *** * ***

}



void * ** * ** *

{
*** * ***** * * ****** ** *
* * * *** * * * *
******* * *** * ** ** ** * **
***** * * * **** ** * ******* *

}



// * * ** * * * * * *** ** * ***** **

// ** * * ** * for **** ** Point and * **

// * * ***** * * *** **** ** * ****


* **



// * **** ** ** * Point and ** * *

int *

{
** * ****** * * * * ** * a *** * * *** class **** (x = y = 0):
* * ** ** * * * ****** p1;
* * ** **** ** ** ** * * * ** *** * x value for p1 is **** * * * * ** ** **** * ** ** **
* * ** * * * *** * * ** ** **** * ** * ** y value for p1 is ** * * * * ** * * * * **** **


**** * * * * *** *** * ** *** *** a point with ** X = 2, Y = 3:
* * **** ** * ** ** p2(2, 3);
*** * * *** *** ** * * ** * *** * * * ** ** x value for p2 is ** * * ** *** *** * ***** ** * * *
* * * *** ** *** * * * *** * * * * *** y value for p2 is * * * * * * * * ** **** * * * *


* ** * **** *** * * * point p2 by (1, -1):
* *** ***** ** ***** ** -1);
* ** ** ** * * *** **** **** * ****** *** *** the * ** * **** *** **
*** **** ** * *** *** *** **** * ** **** ** * * x value for p2 is * ***** * * ***** ** * ****
**** * * * * ****** * ** *** * ******** * *** ** y value for p2 is *** * ** * * * *** ** * ** * ***


*** * * * * ** * ** ** **** ** * 1. Test * ** print on **** p1, p2:
** ** ** ***** * ** * * ** **
* * **** ** ** * ** ** * * * *****
* ** * **** *** *** * *
** *** ** ** **** * *** ** 2. of the class * ** goes here:


* ** ** *** ** * ** ** r1;
** * * *** * * *** ** * *** * * *** * * for r1 is * * *** ****** ***** ***
*** *** * * * ** ** * *


*** ** * * * * ** **** * * * ***** * **
** * ** **** *** * ** ** ** * * ** ** * ***
*** ** * *** * * * **** *** ** ** ** * * * for r2 is ****** ** * * * *
** *** ** * * * * * * **** *


***** * * * ** ** * * 0;

}


** ***** * * * * ******* ** ** ** *
answered by (5.2k points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.130.232
©2016-2024

Related questions

0 like 0 dislike
27 answers
[Exercise] Coding (C) - asked Apr 27, 2017 in C++
ID: 24389 - Available when: Unlimited - Due to: Unlimited
| 893 views
0 like 0 dislike
23 answers
[Exercise] Coding (C) - asked May 11, 2017 in C++
ID: 24589 - Available when: Unlimited - Due to: Unlimited
| 805 views
0 like 0 dislike
26 answers
[Exercise] Coding (C) - asked May 11, 2017 in C++
ID: 24587 - Available when: Unlimited - Due to: Unlimited
| 742 views
0 like 0 dislike
30 answers
[Exercise] Coding (C) - asked May 18, 2017 in C++
ID: 24769 - Available when: Unlimited - Due to: Unlimited
| 831 views
0 like 0 dislike
17 answers
[Exercise] Coding (C) - asked Jun 1, 2017 in C++
ID: 24855 - Available when: Unlimited - Due to: Unlimited
| 620 views
12,783 questions
183,443 answers
172,219 comments
4,824 users