Etape 2
This commit is contained in:
parent
82d031976d
commit
37b003e51a
2 changed files with 57 additions and 0 deletions
41
src/etape2/point2d.cpp
Normal file
41
src/etape2/point2d.cpp
Normal file
|
@ -0,0 +1,41 @@
|
|||
#include <iostream>
|
||||
#include "point2d.h"
|
||||
|
||||
Point2D::Point2D()
|
||||
: Point2D(0,0)
|
||||
{}
|
||||
|
||||
Point2D::Point2D(float x)
|
||||
: Point2D(x,0)
|
||||
{}
|
||||
|
||||
Point2D::Point2D(float x, float y)
|
||||
: _x(x), _y(y)
|
||||
{}
|
||||
|
||||
Point2D::~Point2D()
|
||||
{}
|
||||
|
||||
void Point2D::Saisie(float x, float y)
|
||||
{
|
||||
_x = x;
|
||||
_y = y;
|
||||
}
|
||||
|
||||
void Point2D::Affiche()
|
||||
{
|
||||
std::cout << "[POINT] X= " << _x << "\tY=" << _y << std::endl;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
Point2D pointA(2.0f,3.0f);
|
||||
Point2D pointB(1.0f);
|
||||
Point2D pointC;
|
||||
pointA.Saisie(4.31f, 5.45f);
|
||||
|
||||
pointA.Affiche();
|
||||
pointB.Affiche();
|
||||
pointC.Affiche();
|
||||
return 0;
|
||||
}
|
16
src/etape2/point2d.h
Normal file
16
src/etape2/point2d.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
#ifndef HEADER_POINT2D
|
||||
#define HEADER_POINT2D
|
||||
|
||||
class Point2D {
|
||||
public:
|
||||
Point2D();
|
||||
Point2D(float x);
|
||||
Point2D(float x, float y);
|
||||
~Point2D();
|
||||
void Saisie(float x, float y);
|
||||
void Affiche();
|
||||
private:
|
||||
float _x,_y;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Add table
Reference in a new issue