consolidate all repos to one for archive
This commit is contained in:
39
semester_2/programiranje_2/primeri/Example02/main.cpp
Normal file
39
semester_2/programiranje_2/primeri/Example02/main.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
#include <iostream>
|
||||
#include "Point.h"
|
||||
|
||||
int main() {
|
||||
Point a;
|
||||
Point b(5);
|
||||
Point c(4,3);
|
||||
Point d(c);
|
||||
a.print();
|
||||
b.print();
|
||||
c.print();
|
||||
d.print();
|
||||
std::cout << a.distance(c) << std::endl;
|
||||
//std::cout << a.distance(5) << std::endl;
|
||||
/*
|
||||
Point arr[3]; // default constructor is called
|
||||
for (int i=0; i < 3; i++)
|
||||
arr[i].print();
|
||||
*/
|
||||
/*
|
||||
std::cout << "-----Dynamic allocation-----" << std::endl;
|
||||
Point* e = new Point();
|
||||
Point* f = new Point(5);
|
||||
Point* g = new Point(2,3);
|
||||
Point* h = new Point(*g);
|
||||
//e.print();
|
||||
//*e.print();
|
||||
//(*e).print();
|
||||
e->print();
|
||||
f->print();
|
||||
g->print();
|
||||
h->print();
|
||||
delete e;
|
||||
delete f;
|
||||
delete g;
|
||||
delete h;
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user