#include using namespace std; class Date { public: int day; int month; int year; string note; Date (); void print (); void next (); bool less (Date v); }; Date::Date () { day = 1; month = 1; year = 2000; note = ""; } bool Date::less (Date v) { if (year < v.year) return true; else if (this->year > v.year) return false; else if (month < v.month) return true; else if (month > v.month) return false; else return day < v.day; } void Date::print () { cout << day << "-" << month << "-" << year << endl; } void Date::next () { day ++; if (day > 31) { day = 1; month ++; if (month > 12) { month = 1; year ++; } } print (); } /* ---------------------------------------------------------------------- */ class Point { public: int x, y, z; Point (int x0 = 0, int y0 = 0, int z0 = 0); }; Point::Point (int x0, int y0, int z0) : x (x0), y (y0), z (z0) { } void pokus () { Point p (1, 2, 3); Point t (10, 20); Point v (100); Point z; Point * w = nullptr; w = new Point; Point * q = new Point (10, 20); } /* ---------------------------------------------------------------------- */ class Array { private: double * data; int size; public: double get (int inx); void set (int inx, double val); Array (int size0); ~ Array (); }; double Array::get (int inx) { return data [inx]; } void Array::set (int inx, double val) { data [inx] = val; } Array::Array (int size0) { size = size0; data = new double [size]; cout << "Vznika pole o delce " << size << endl; } Array :: ~ Array ( ) { delete [] data; data = nullptr; cout << "Nicime pole o delce " << size << endl; size = 0; } /* ---------------------------------------------------------------------- */ int main() { Array aa (10); Array bb (100); Date b; Date c; b.less (c); b.day = 31; b.month = 1; b.year = 2018; b.note = "Konec ledna"; b.print (); b.next (); b.print (); return 0; } /* ---------------------------------------------------------------------- */ int g; void f (int i) { i = i + 1; cout << i << endl; } void ff (int * i) { *i = *i + 1; cout << *i << endl; } void fff (int & i) { i = i + 1; cout << i << endl; } void test () { int k = 2; // f (k); // ff (&k); fff (k); cout << k << endl; }