12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- #include <iostream>
- #include <stdio.h>
- #include <math.h>
- using namespace std;
- class Date
- {
- public:
- Date() : day(1), month(1), year(2000) {}
- Date(int d, int m, int y) : day(d), month(m), year(y) {}
- ~Date() {}
- private:
- int day;
- int month;
- int year;
- public:
- int getDay() {
- return day;
- }
- void print()
- {
- cout << day << "." << month << "." << year << endl;
- }
- };
- //
- class Power
- {
- public:
- Power() {}
- Power(double val_one, double val_two) : a(val_one), b(val_two) {}
- private:
- double a;
- double b;
- public:
- void set(double val_one, double val_two)
- {
- a = val_one;
- b = val_two;
- }
- double calculate()
- {
- return pow(a, b);
- }
- };
- //
- class RGB
- {
- public:
- RGB() : red(0), green(0), blue(0) {}
- RGB(unsigned char r, unsigned char g, unsigned char b) : red(r), green(g), blue(b) {}
- private:
- unsigned char red;
- unsigned char green;
- unsigned char blue;
- public:
- void print() {
- cout << "(" << (int)red << "," << (int)green << "," << (int)blue << ")" << endl;
- }
- void invert() {
- red = 255 - red;
- green = 255 - green;
- blue = 255 - blue;
- }
- };
- int main() {
- // Date today(6, 9, 2023);
- // today.print();
- // Date birthday;
- // birthday.print();
- // Power p(2, 2);
- // cout << p.calculate() << endl;
- RGB rgb(12, 54, 231);
- rgb.print();
- rgb.invert();
- rgb.print();
- return 0;
- }
|