Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <Windows.h>
- using namespace std;
- // структуре можно присвоить значение по умолчанию
- struct date {
- int day = 1;
- char month[20]{"январь"};
- int year = 1990;
- };
- // структуры можно вкладывать одну в другую
- struct person {
- char name[40];
- char address[40];
- date birthday;
- };
- int main() {
- SetConsoleCP(1251);
- SetConsoleOutputCP(1251);
- date date1;
- cout << date1.day << " " << date1.month << " " << date1.year << endl;
- person p1{ "Иван", "Ленина, 35", {1,"июня", 1995} };
- cout << p1.name << " " << p1.address << ", дата рождения: " << p1.birthday.day << " " << p1.birthday.month << " " << p1.birthday.year << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement