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