initial commit
This commit is contained in:
43
C++/lesson7/task8.cpp
Normal file
43
C++/lesson7/task8.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
#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);
|
||||
}
|
Reference in New Issue
Block a user