This repository has been archived on 2024-08-23. You can view files and clone it, but cannot push or open issues or pull requests.
lessons/C++/lesson7/task8.cpp
2023-07-16 13:23:25 +00:00

44 lines
1.0 KiB
C++

#include <iostream>
#include <string>
enum EventKind {
Lesson,
Meeting,
Celebration
};
struct Event {
std::string name;
std::string time;
std::string date;
EventKind kind;
Event(std::string name, std::string time, std::string date, EventKind kind) {
this->name = name;
this->time = time;
this->date = date;
this->kind = kind;
}
void information() {
std::cout
<< '(' << name << ',' << time << ',' << date << ',' << kind << ')' << '\n';
}
~Event() {
std::cout
<< '(' << name << ',' << time << ',' << date << ',' << kind << ')' << " was deleted\n";
}
};
void display_events(Event events[], size_t length) {
for (size_t i = 0; i < length; i++) {
events[i].information();
}
};
int main() {
Event m[3] = {Event("NewYear", "00:00", "31:12:2023", Celebration), Event("Breefing", "17:00", "15:06:2023", Meeting), Event("AI", "10:00", "03:07:2023", Lesson)};
display_events(m, 3);
}