5 like 1 dislike

In this exercise you will finish a program have a Point class that represents a point in 2-dimensional Euclidean space, supporting the operations listed below.

You should assume class Point is defined as follows:

class Point {
   public:
      // operation 1. a constructor with given x and y coordinates
      Point(double xpos, double ypos); 
      // operation 2. get a string representation
      string to_string();
      // operation 3. check if two points have the same location
      bool equal_to(Point other);
      // operation 4. transform the point by swapping its coordinates
      void reflect();
   private:
      double x;
      double y;
};

And the main function you should follow in this Exam:

int main(){
	double ax,ay,bx,by;
	cin>>ax>>ay>>bx>>by;
	Point A(ax,ay);
	Point B(bx,by);
	cout<<A.to_string()<<endl;
	if (A.equal_to(B)) cout<<"A equal B"<<endl;
	else cout<<"A not equal B"<<endl;
	A.reflect();
	cout<<A.to_string()<<endl;
	return 0;
}

Example input 1:

12 10 5 7

Example output 1:

(12, 10)
A not equal B
(10, 12)

Example input 2:

11 15 11 15

Example output 2:

(11, 15)
A equal B
(15, 11)
[Exercise] Coding (C) - asked in Final Exam
Available when: 2016-06-22 14:30:00 - Due to: 2016-06-22 17:00:00

edited by | 34 views
0 0
Called for Help
0 0
Called for Help
0 0
#include <iostream>
#include <cstring>
using namespace std;

class Point
{
public:
    // operation 1. a constructor with given x and y coordinates
    Point(double xpos, double ypos)
    {
        x = xpos;
        y = ypos;
    }
    // operation 2. get a string representation
    void to_string()
    {
        cout << "(" << x << ", " << y << ")" << endl;
    }
    // operation 3. check if two points have the same location
    bool equal_to(Point other)
    {
        if((this->x == other.x) && (this->y == other.y))return true;
        return false;
    }
    // operation 4. transform the point by swapping its coordinates
    void reflect()
    {
        double temp;
        temp = x;
        x = y;
        y = temp;
    }

private:
    double x;
    double y;
};

int main()
{
    double ax,ay,bx,by;
    cin >> ax >> ay >> bx >> by;
    Point A(ax, ay);
    Point B(bx, by);
    A.to_string();
    if (A.equal_to(B)) cout << "A equal B" << endl;
    else cout << "A not equal B" << endl;
    A.reflect();
    A.to_string();
    return 0;
}
0 0
#include <iostream>

using namespace std;

class Point {
   public:
      // operation 1. a constructor with given x and y coordinates
      Point(double xpos, double ypos);
      // operation 2. get a string representation
      string as_string();
      // operation 3. check if two points have the same location
      bool equal_to(Point other);
      // operation 4. transform the point by swapping its coordinates
      void reflect();
   
   private:
      double x;
      double y;
};
Point::Point(double xpos, double ypos)
{
    x = xpos;
    y = ypos;
}
string Point::as_string()
{
    int i
    string arr[5]={x,y};
    cout<<arr<<endl;
}
void Point::reflect()
{
    int a, b;
    int temper;
        a = temper;
        b = a;
        temper = b;  
}


int main(){
    double ax,ay,bx,by;
    cin>>ax>>ay>>bx>>by;
    Point A(ax,ay);
    Point B(bx,by);
    cout<<A.to_string()<<endl;
    if (A.equal_to(B))cout<<"A equal B"<<endl;
    else cout<<"A not equal B"<<endl;
    A.reflect();
    cout<<A.to_string()<<endl;
    return 0;
}
0 0
#include <iostream>
#include <fstream>                                     // Line 1
using namespace std;

class Point {
   public:


Point(double xpos, double ypos);
string to_string();

bool equal_to(Point other);

void reflect();
double getx()
{
    return x;
}

double gety()
{
return y;
}

private:
     double x;
      double y;
};

Point::Point(double xpos, double ypos)
      {
        x = xpos;
         y = ypos;
      }


 void to_string()
      {
      // string a,b;
     cout <<"("<<xpos<<","<<" "<<ypos<<")"<<endl;

      }

      bool equal_to(Point other)
      {
         ;
        if (x==y)
            return 1;
        else
            return 0;
      }

 void reflect()
      {
          int f, p;
        int temper;
        f= temper;
        p = f;
        temper =p;

      }

int main(){
    double ax,ay,bx,by;
    cin>>ax>>ay>>bx>>by;
    Point A(ax,ay);
    Point B(bx,by);
    cout<<A.to_string()<<endl;
    if (A.equal_to(B)) cout<<"A equal B"<<endl;
    else cout<<"A not equal B"<<endl;
    A.reflect();
    cout<<A.to_string()<<endl;
    return 0;
}

24 Answers

0 like 0 dislike
Hidden content!
#include *** * * * **

#include * ** * ** *

#include ** ** *

using namespace std;



class Point {
*** * *** *
* ** * * *** *** * * *** ** **** ** xpos, double ypos); // operation 1
* * ** * *** * ***** * *** ** ** * * ** *
* * * *** **** ******* * *** other);
* * * * * * ** * * **** * ** * * *
* ** ** ******
* ***** ** * * * ** ***** ** * * x;

double y;

};



// operation 1
** ** * *** ** ** xpos, double ypos) {
* * * * * ***** * * = xpos;

y = ypos; }

// operation 2. use default numeric * * ** ** * ** not needed

string ** * * * {
* ***** * * ** oss;
* * * **** * ** * ** '(' * * * x ** * " * ** * * y ** * ')';
** ** *** * **** *****

}

// operation 3
* ** ** ** * *** * * * other) {
* ** * * * * * * ** * *** **** * * ***

}

// operation 4

void * * ** * {
* * ** * * *** * ** ** * tmp = x;
* ** * *** = y;
** *** * * ** * * * = tmp;

}



int main(){
* * * ** *** ** *** ** * *
* *** * * ***** * * * * ** * *** * * ******* *** ** *** *** * ***
** *** ***** * **** *** ** A(ax,ay);
* ***** * *** **** ** * B(bx,by);
** ** *** * * ** * * ** *** * * * * *** * **
** * * ** *** * * *** * ** *** * * ** * ** equal * * * * *** * * * *
** ** ** ** ************ ** * * * * not equal * * * ***** ** *
**** * **** *** *** ** * ***** *
** *** * ** * ***** * * * * * ** * ** * *****
* ** * * * ****** * 0;

}
answered by (11.8k points)
0 like 0 dislike
Hidden content!
include <string>

#include * *** ** * * ** ***

using namespace std;

class Point

{

public:
* **** **** * *** * * * ** xpos, double ypos)


** ** * *** * *
* * * ** * * ****** * ** ****** **** * * ** * = xpos;
* **** * ***** * * ***** * * * ******* * * = ypos;
* * * * * * * * *** * // operation 1
** *** ** *** * * * * * as_string()


** ** ***** ** *** * *
** * *** *** * ** ** *** * ** ** * *** ** **** * * oss;
** *** ** * * **** **** ** *** * *** << '(' << x << ", " << y << ')';
* ** ** * ** * ** ** **** ** ******* * * * * oss.str();
** * * * * ** * ** ** * ** *** * *** * ****** * * ** * ****** * * * * operation 2
* * **** *** * **** * * * equal_to(Point other)


***** **** * * *
* *** ** * * * * * * * * ******* * * *** (x==other.x) && (y==other.y);
* * * * ** ** **   ;  // operation 3
* *** * * ** ** ** * ** reflect()
* * ** * **** **
** * * ** ** **** * * *** ** * ** * ****** tmp = x;
** * * * ** *** *** ***** ** * ** *** * * * = y;
**** ** ** ** *** ** * ** * ** *** * ** * = tmp;
* ** **** *** ** * * ** * * * ** * * ** * ** ** * ****** * * * * ** * *** ******* ** * * ** ** operation 4

private:
*** * ** * ** ** * **** * * x;
* ** ** *** * *** ** y;

};



int main()

{
*** * ***** ** **** * *** ax,ay,bx,by;
*** * * ** * *** **** * * **** * ** ** * * * ***** * * * ** ** *
* * * *** *** * A(ax,ay);
* * * * ** * ** * ** * B(bx,by);
* *** *** * * ****** ** * * * ***** * * **** *
*** * * * ***** *** * (A.equal_to(B)) * **** * equal * * ** * *
*** *** * * **** ** * * * * * * * not equal ** **** * ** ** **
** * ** *** ** ** * **
* ** *** *** ** **** * ** **** *** * ** ** *
* * ***** * ** * * * * 0;

}
answered by (-164 points)
0 0
#include <iostream>
#include <cstring>
using namespace std;

class Point
{
public:
    // operation 1. a constructor with given x and y coordinates
    Point(double xpos, double ypos)
    {
        x = xpos;
        y = ypos;
    }
    // operation 2. get a string representation
    void to_string()
    {
        cout << "(" << x << ", " << y << ")" << endl;
    }
    // operation 3. check if two points have the same location
    bool equal_to(Point other)
    {
        if((this->x == other.x) && (this->y == other.y))return true;
        return false;
    }
    // operation 4. transform the point by swapping its coordinates
    void reflect()
    {
        double temp;
        temp = x;
        x = y;
        y = temp;
    }

private:
    double x;
    double y;
};

int main()
{
    double ax,ay,bx,by;
    cin >> ax >> ay >> bx >> by;
    Point A(ax, ay);
    Point B(bx, by);
    A.to_string();
    if (A.equal_to(B)) cout << "A equal B" << endl;
    else cout << "A not equal B" << endl;
    A.reflect();
    A.to_string();
    return 0;
}
0 like 0 dislike
Hidden content!
* **
answered by (6 points)
0 0
#include <iostream>
#include <string>

using namespace std;

class Point
{
public:
    // operation 1. a constructor with given x and y coordinates
    Point(double xpos, double ypos)
    {
        x = xpos;
        y = ypos;
    }
    // operation 2. get a string representation
    string to_string()
    {


    }
    // operation 3. check if two points have the same location
    bool equal_to(Point other)
    {
        if(x == other.x || y == other.y)
            return 1;
        else
            return 0;

    }
    // operation 4. transform the point by swapping its coordinates
    void reflect()
    {
        double temp;
        temp = x;
        x = y;
        y = temp;
    }
private:
    double x;
    double y;
};

int main()
{
    double ax,ay,bx,by;

    cin >> ax >> ay >> bx >> by;

    Point A(ax,ay);
    Point B(bx,by);

    cout << A.to_string() << endl;

    if (A.equal_to(B))
        cout<<"A equal B" << endl;

    else cout << "A not equal B" << endl;
    A.reflect();

    cout << A.to_string() <<endl;

    return 0;
}
0 like 0 dislike
Hidden content!
#include * *** **

#include * *** * *



using namespace std;



class Point

{

public:
* ***** *** *** * ** operation 1. a constructor with given x and y coordinates
* * ** ** * * ** ***** * **** xpos, double ypos)
*** **** **** * *****
* * ** * *** ** *** * * *** *** * * ** * * = xpos;
** **** *** **** * ** ** *** * *** ** * * ** = ypos;
* ** * * * * *** * * *
* * **** ******* **** operation 2. get a string ** * *
*** ** *** * to_string()
** * * * ***** * * *




** * * * ****** ** ** * **
***** * * **** *** * operation 3. check if two points have the same location
*** *** * ** * ***** * other)
** ** ** * * * *
* * *** * ** * ******* ******* **** * *** ** == other.x || y == other.y)
****** ** ** * ** ** * * ** **** * * ***** * ******* *** * ** *** 1;
* * ****** ** * **** * * * * * *** * *
** * ** ** * * ** * **** ** ** * * * ** * * * * *** ****** ** 0;


***** * * ** *** * ** *** *
**** * *** * ** ** * operation 4. transform the point by swapping its coordinates
** *** ** * * * *** reflect()
** *** *** ***
* * **** **** ** ***** ******* * * temp;
** ***** * * * * * *** ***** ***** ** ** *** **** = x;
***** ****** *** ** ** **** * *** * *** ** = y;
* **** ** * *** ** * *** **** * * * = temp;
****** ** **** ** * * *

private:
* ****** ** *** ** * * * x;
* ******* * * * ***** * y;

};



int main()

{
** * ** ** * * ** ax,ay,bx,by;


* * ** ** * * * ** ** ax **** * ay * ** * * bx * * * **** by;


***** **** *** ** * A(ax,ay);
* * * ** ** * ** *** B(bx,by);


** ** * * * * ** * ** ** * * * * * endl;


** * * * *** ** * * ** ** *
** * ***** **** ** ** ** * **** * ** ** * * **** ** ** * * equal B" ***** endl;


* * *** * * *** *** cout ***** * ** "A not equal B" * * * * endl;
** **** ** * * * * * * * * * * *


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


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

}
answered by (-74 points)
0 like 0 dislike
Hidden content!
* * * * ** *** *
* * * *** * *** *



using namespace std;

class Point {
**** **** ***** **
* ** *** ** ******* * * ** *** operation 1. a **** * with given x and y *
** * * * * * * * *** * **** * * ** ** * * xpos, double ypos);
* * * * **** * * ** * * **** * ** 2. get a string *** * * *
* *** * **** * * *** *** ** ** ** *
** * ******* **** * * *** **** * **** * ** * * 3. check if two points have the same location
*** *** * * ********* * ** ** ** * * ** * other);
* **** * ** * ** ** ** * ** operation 4. transform the point by swapping its *** *
* ** *** * ** ****** * * * *** ****
* * ** * * *** *
**** **** ** * * ** ** * * * ******* * x;
* * *** **** * * * ** ** * *** y;

};


* * ** * xpos, double ypos) {x=xpos; y=ypos;}



void * ***** * *** * ** ** ** * ** * * *** ** * **** * * *** ***** * ** ** ** *** * ****** * ** ** * ** * * ***** ** ***



bool Point:: equal_to (Point other) ****** * ** ** * * ** * *** * *** ** true; ***** * * false;}}



void Point:: * * * r=0; r=x; x=y; y=r;}



int main()

{ double * **
* ** * *** ***** ** ** ** ** * *** *** ** * **** *
* * * *** ** *** * A(ax,ay);
***** ** * ** **** * B(bx,by);
* * *** ** * * *** **** * ******* * *
*** ** * ** * *** ** * ******* * equal *** **** * *** *
* ** * * * **** **** * ** ** * *** ** not equal ** * ** ** * ***
* ** **** * ***** * **** *
** * * * * * *** ** * * **** *


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

}
answered by (10 points)
0 like 0 dislike
Hidden content!
#include * * ** ******

#include *** ** *

using namespace std;



class Point

{
* * * * * ** ***
** ** **** ** ** *** ** ** * operation 1. a constructor with given x and y coordinates
* ** * *** * * * * ** * * * ** ** xpos, double ypos):x(xpos) , y(ypos){};
*** ** ** **** * * *** * * * ** operation 2. get a string representation
* ** ** ** ** * *** ******** ** to_string()
* * * * ** * * * ****** * *
* **** * ** * ** *** ***** * * * * ** * ** **** * << * ** * ** * << x << "," << ' ' << y ** ** ** ** * * ** ;


** ** ** * *** * * * *** * * **
* ** * ** * *** * * *** operation 3. check if two points have the same location
** * ** *** * * * * ** * ** ** * equal_to(Point other)
* * * ** * **** * *** ** *** *******


* *** ** * * ** * * * ****** *** ***** **** * ** * *** * ** == other.x) && (this->y == other.y))
** * ** * ** * * * *** ** ** *** *** * ***** * * * * ** * * * 1;
** * ** * * * * * ** *** *** * * * ** * ** * ** * *** *
* ** *** **** * * ** * ***** *** * * **** **** * * * * ******* * * 0;
*** *** ** *** * * **** * ***********
** ** *** ** * **** * * **** * * operation 4. transform the point by swapping its coordinates
* * * * ** * **** **** * **** ** * reflect()
* * *** **** * * ** ** ** * * *
* * * * * ** ******** ***** * * * * = x ;
** *** *** ** * * * * *** = y ;
* ***** * * * ** ** *** ****** * * = z ;
** ** * ****** * *** * * * *
** ***** *
* ** *** * * ** * ** * * * *** * ** x;
** * **** *** * * * **** ** ** y;
*** ** * * * *** ** * *** * * * * z;

};



int main(){
** ** * ** ** * ** * ax,ay,bx,by;
* * * ** ** *** * * **** * * * ** *** *** * * **** ** ***** ****
*** ** ****** ** *** A(ax,ay);
***** * ** ** ** B(bx,by);
* **** * *** * * * ** * * *** ** **


** * ** ** ***** * *** ** * (A.equal_to(B))
* * **** * * * ** * **** * * * * * * ** * ****** equal *** ** * ** * **
* ** **** * * *** **
* ** * * * * *** *** * * * ** *** * ** * * * * not equal ** * **** ** ****


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

}
answered by (-103 points)
0 like 0 dislike
Hidden content!
** ** **** * * *
* ***** * ******
* * * ** ** *



class Point {
****
* * *** * ** *** * * * * * ** 1. a **** * with given x and y * *
* * * *** * * ******* ** * ** xpos, double ypos);
** ** * * ** ** *** ** *** * * * 2. get a string * ** *
* * * *** ***** ********* * * **
* **** ** * ** *** * * ** ** * ** 3. check if two points have the same **
* ** * *** ** ** *** * *** **** * other);
* ** * ** ** ** ** * * 4. *** * the point by swapping its ******
**** ***** * * ** ** * *
** *
** * ** * * *** x;
** * ** ** * * * y;

};


* * ** ** xpos, double ypos) : x(xpos), y(ypos)

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

}


* * * ** *

{
* ** ** **** ** ** *** **** ******* ss;
**** ** ** * * *** ** * ** *** * ** * * * * ** * ** x * * **** * *** ** * * * * y * ** ** ** ** * *
**** * * ** *** * *** * *****

}



bool * *** * * * other)

{
* *** * ** * * * * * ***** x == other.x * ***** * y == ** *

}



void * *** **

{
*** ** ** **** * *** * ** *** tmp = x;
* * ** ****** *** = y;
*** ***** ** * *** * * = tmp;

}



using * * ** std;



int main(){
** *** ** ** * ** ** * ax, ay, bx, by;
* *** ** * * * * ***** * * * * * ax * * ay ** * * * bx * by;
** * **** * * * * A(ax, ay);
*** * ** ** * * * B(bx, by);
* **** ** * * ** * * *** * *** * * * * * * endl;
* ** ** * ** ** * * **** ** cout * * *** ** **** equal * ** * * endl;
* ** ** * cout * ** * * * * * ** not equal ** * * ** ** * *** endl;
***** * * ** **** * ** * ***
** * * * * * * ** **** ** * ** * *** ****** endl;
**** * *** * ** 0;

}
answered by (157 points)
reshown by
0 like 0 dislike
Hidden content!
#include * ** *** *** * * *

#include ** * ******

using namespace std;



class Point

{

public:
* ** **** * ** * * operation 1. a constructor with given x and y *** **
* **** * * ** ** ** * ******* xpos, double ypos)
** ** * *** * ****** **
* * * ****** *** * ** **** *** * * ** * ** * = xpos;
* *** * *** * * ** * *** ** * * ***** * **** * * = ypos;
** **** * * * * * ****
** ** * * ** **** ** * operation 2. get a string * **
* * * *** *** ****** * * *
** *** ***** **
* * * * * * ** **** **** ** * ** ** ** ** * * **** **** x * * * ", " * * y * * * * **** *** * * *** * endl;
*** * ** * *** ** * *
** *** ** * * * * operation 3. check if two points have the same location
* * * * ** * * * ** * * **** other)
* ** * **** * *** **
* * *** * * ** * * ** * ** ** * * **** ** * ******* * *** == other.x) ** ****** ** ** ** * == * *** ** true;
*** * *** * * ******** **** * ** *** * * false;
* ** ** ***** *** * **
* * ******* **** * *** operation 4. transform the point by swapping its coordinates
* *** * * **** * ** reflect()
**** **** ** ** * * ***
* * *** * **** * ** * ** ** *** *** ** *** *** * temp;
* * **** ** ***** * ***** * * * * ** * ** * = x;
* * * * *** *** * * **** ** ****** ** ** *** *** = y;
*** * * **** **** *** * * * * * * ***** = temp;
*** **** *** *** ***



private:
** * * * ** * ****** * x;
* ** ** ** * **** * *** *** y;

};



int main()

{
* * ** * * * * * * *** ** * * ** *
* ** * ** * * *** * * * * ** * ax *** ay * * * bx * * by;
** * * * ** * * *** ** A(ax, ay);
** * * *** * ** * *** B(bx, by);
* * * ***** * ****** * **
* ***** * ** ** *** ** * *** ** cout ** * ****** "A equal B" ** * **** endl;
** ** * ** **** cout ** ** * * "A not equal *** *** * ** *** endl;
**** ** *** * *** * *
** * * *** **** * ** ** **
* * * * ** ** * 0;

}
answered by (16 points)
0 like 0 dislike
Hidden content!
#include * * ***** ***

#include * ***** ** *

using namespace std;



class Point

{
* ** ** * *** * ** * **
*** **** * * ** * ** ***** * * * ** operation 1. a constructor with given x and y coordinates
* * * **** * * * ** ** * * **** * xpos, double ypos):x(xpos) , y(ypos){};
**** * ** *** * * ** ***** * ** * operation 2. get a string representation
**** * * ** * * * **** **** * *** ** ** to_string()
***** * * * ** *** ** * ** *
* *** *** *** ** * * * **** * ** ** ** * * ** * * * * * ** << "(" << x << "," << ' ' << y *** ** **** * * ** *** ** ;


*** * ***** **** * ** * ** ***
* * * * * * * ******* *** ** * ** operation 3. check if two points have the same location
*** ** * * * *** * *** * **** equal_to(Point other)
** ******* **** * * * *** **


** * * * *** ** * ***** * * ** ** ** ** * * * * *** * && y==other.y)
** **** * ****** * * * *** ** * * ** *** * ***** ** * * 1;
* ** ** ** * ** **** ** ** * **** ** * *** * *
* ** * * * * ** * * ** **** * ** * *** ** ** * ***** ** * * 0;
* * * * * **** * ***
* ****** * ** ** * * *** * * ** operation 4. transform the point by swapping its coordinates
* ** * * ** * * * *** * *** * * *** reflect()
* * ** *** * * ** * * * * ** *
* * * ********* * **** ** **** * = x ;
* ****** ** ** ***** * **** * * ** = y ;
*** **** *** * **** * ** *** * = z ;
** * *** ***** * **** ** ******* ****
* **** *** * ** * *
* ** * *** * * ** **** * * *** * ** x;
** * ** * * ** ** * ** ** * ** ** * y;
* * **** ** **** ** ** ***** *** * * * ******* z;

};



int main(){
* * **** *** ** ** ** * ** * * ax,ay,bx,by;
*** * * *** ** ** *** *** * * ** ** ** * ** ** ** *** *** *** *
* ** * * * **** ** * * A(ax,ay);
* ** * *** * * **** B(bx,by);
* **** * * ** ** *** * *


*** ** * * ** **** * (A.equal_to(B))
* ** * * *** ** *** * * **** * * *** ** equal ** * *** ***** **
* * * * **** ** * ** ** *
* * ** * * *** * * ***** ** * * * * * *** ** *** not equal * **** * *** *


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

}
answered by (-103 points)
0 like 0 dislike
Hidden content!
#include * * ** *

#include * * ** *

using namespace std;



class Point

{

public:
* **** ** ** * * * operation 1. a constructor with given x and y coordinates
* *** * * *** * * **** ** xpos, double ypos)
***** ** **** * * * ** **
***** *** ** *** * * * * * * * * = xpos;
** * ** **** ***** * * * * *** * * * **** = ypos;
** **** ** **** *
* *** ******** *** * operation 2. get a string *** ***
****** * ** *** * *** * ** * to_string()
* ** * **** * ** ** *
** *** * * * * ***** * ** * ** **** ** *** * * str = * * * ** * *
*** * * *** * * *** * *** * * * ** *** * * ** = x;
*** * ** * ***** * ** * ** ****** * *** **** = y;
* * **** ** * ** * *** * *** * *** ** * str;
* * *** ********* *** ******
* * * * * * * * ** ***** operation 3. check if two points have the same location
* *** ** ** ** * * *** * * * other)
* *** * ** ** * *** **
** * ** ********* *** * * *** *** ** **** ** * * * *** ** == other.x) *** ** * ** ** * == * ** ** true;
** * * **** * * * *** * * * * * * ****** false;
* * * * * *** **
** ******** ** * **** ***** operation 4. transform the point by swapping its coordinates
*** * ** * ** * *** * ** reflect()
* ** * *** * *** *
*** * ** ** ** * ** ****** * ** * ** ** *** temp;
* * *** ***** ** * * ** **** * *** **** = x;
*** * * ** * * ** * ** * **** * ** ** **** = y;
* ** * ** ** * **** * * ** *** * * * * = temp;
***** * ***** **** ******



private:
** ** *** * * * * ** * *** x;
* * * ** **** * * * * y;

};



int main()

{
* * * ** ** **** *** *** ax,ay,bx,by;
* **** * * ***** *** * ** ** ax ** * ** ay **** * ** bx ** * by;
* ** ***** ***** * *** * A(ax, ay);
** *** **** * ** * ******* * B(bx, by);
****** *** * * ** * * ** * **** * ** * * ** ******* * endl;
*** * * * *** * **** **** ** cout * * * "A equal B" * * ** endl;
**** ** * * *** * * * cout ** * * * "A not equal B" * **** endl;
* *** ** ** * *** * *****
***** * * * ** * * ** * *** **** * ** * * ** * * endl;
** ** * *** ***** * ** 0;

}
answered by (16 points)
Get it on Google Play Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.62.178
©2016-2018

Related questions

7 like 0 dislike
25 answers
[Exercise] Coding (C) - asked Jun 22, 2016 in Final Exam
Available when: 2016-06-22 14:30:00 - Due to: 2016-06-22 17:00:00
| 33 views
3 like 1 dislike
8 answers
[Exercise] Essay (Open question) - asked Jun 22, 2016 in Final Exam
Available when: 2016-06-22 14:30:00 - Due to: 2016-06-22 17:00:00
| 31 views
6 like 0 dislike
32 answers
[Exercise] True/False - asked Jun 21, 2016 in Final Exam
Available when: 2016-06-22 14:30:00 - Due to: 2016-06-22 17:00:00
| 29 views
7 like 0 dislike
44 answers
[Exercise] Multichoice - asked Jun 21, 2016 in Final Exam
Available when: 2016-06-22 14:30:00 - Due to: 2016-06-22 17:00:00
| 17 views
6 like 0 dislike
20 answers
[Exercise] Essay (Open question) - asked Jun 16, 2016 in Final Exam Preparation
Available when: Unlimited - Due to: Unlimited
| 53 views
2,974 questions
57,433 answers
29,089 comments
938 users