Crear actividad
Jugar Completar texto
/ *
Purpose : declare a Point class type with inline member function to model a 2D point
* /

#include iostream / / for streaming i / o
using ____________________ std ; / / reserve library for standard use

/ / declare the Point class to model a 2D point
class Point
{
public :
____________________ ( ) { ____________________ = ____________________ ; y = 0 ; } / / the default constructor
Point ( int initX , int initY ) { x = ____________________ ; ____________________ = ____________________ ; } / / the explicit contructor
void Print ( ) const { cout << " ( " << x << " , " << y << " ) " ; } / / to print a point
____________________ ____________________ ( ____________________ ____________________ , ____________________ ____________________ ) { x = newX ; ____________________ = ____________________ ; } / / to move a point
private :
int x ; / / the x coordinate
int y ; / / the y coordinate
} ;

int main ( )
{
Point p1 , / / declare a point at ( 0 , 0 )
p2 ( 1 , 2 ) ; / / declare a point at ( 1 , 2 )

/ / display p1 and p2

cout << " p1 = " ;
p1 . Print ( ) ;
cout << endl ;

/ / move p1 to ( 3 , 6 )
____________________ . ____________________ ( 3 , 6 ) ;

/ / assign p1 to p2

p2 = p1 ;

____________________ << " p2 = " ;
____________________ . ____________________ ( ) ;
cout << ____________________ ;

cout << " p2 = " ;
____________________ . ____________________ ( ) ;
cout << endl ;

/ / successfully done
return 0 ;
}