consolidate all repos to one for archive
This commit is contained in:
28
semester_2/programiranje_2/primeri/Example06/Point.cpp
Normal file
28
semester_2/programiranje_2/primeri/Example06/Point.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
#include "Point.h"
|
||||
|
||||
Point::Point() : x(0), y(0) {
|
||||
}
|
||||
|
||||
Point::Point (int x, int y) : x(x), y(y) {
|
||||
}
|
||||
|
||||
int Point::getX() const {
|
||||
return x;
|
||||
}
|
||||
|
||||
int Point::getY() const {
|
||||
return y;
|
||||
}
|
||||
|
||||
void Point::print() const {
|
||||
std::cout << "(" << x << ", " << y << ") " << std::endl;
|
||||
}
|
||||
|
||||
double Point::distance(const Point& p) const {
|
||||
return std::sqrt((double)(x - p.x)*(x - p.x)+(y - p.y)*(y - p.y));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user