Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- struct Price {
- int rubles;
- int coins;
- };
- struct Time {
- int hours;
- int minutes;
- int seconds;
- };
- struct Date {
- int day;
- int month;
- int year;
- };
- struct Address {
- int index;
- string town;
- string street;
- int house;
- int apartment;
- };
- struct Student {
- string lastName;
- int recordBookNumber;
- int examGrade;
- };
- struct Exam {
- string subject;
- int groupNumber;
- Date examDate;
- Student students[25];
- };
- int main() {
- setlocale(LC_ALL, "Rus");
- Price itemPrice = { 52, 99 };
- struct Price* price_ptr = &itemPrice;
- cout << "Цена: " << price_ptr->rubles << " рублей " << itemPrice.coins << " копеек" << endl;
- Time currentTime = { 10, 30, 45 };
- cout << "Текущее время: " << currentTime.hours << ":" << currentTime.minutes << ":" << currentTime.seconds << endl;
- Date currentDate = { 7, 2, 2024 };
- cout << "Текущая дата: " << currentDate.day << "." << currentDate.month << "." << currentDate.year << endl;
- Address currentAddress = { 123456, "Москва", "Ленина", 10, 5 };
- cout << "Адрес: " << currentAddress.index << ", " << currentAddress.town << ", " << currentAddress.street
- << ", д." << currentAddress.house << ", кв." << currentAddress.apartment << endl;
- Student students[25] = { {"Петров", 1, 90}, {"Сидоров", 2, 75}, {"Соколов", 3, 99 }, {"Михайлов", 4, 98 }, {"Новиков", 5, 97 }, {"Федоров", 6, 94 }, {"Морозов", 7, 93 },
- {"Алексеев", 8, 90 }, {"Козлов", 9, 99 }, {"Степанов", 10, 88 }, {"Орлов", 11, 36 }, {"Андреев", 12, 81 }, {"Макаров", 13, 67 }, {"Никитин", 14, 22 },
- {"Захаров", 15, 94 }, {"Романов", 16, 78 }, {"Чернов", 17, 55 }, {"Григорьев", 18, 41 }, {"Поляков", 19, 63 }, {"Кудрявцев", 20, 73 }, {"Калинин", 21, 45 },
- {"Максимов", 22, 60 }, {"Лазарев", 23, 27 }, {"Ефимов", 24, 52 }, {"Беляев", 25, 1 } };
- Exam exam1 = { "Математика", 1, {15, 2, 2024}};
- for (int i = 0; i < 25; ++i) {
- exam1.students[i] = students[i];
- }
- cout << "Экзамен по " << exam1.subject << " для группы " << exam1.groupNumber << " состоится "
- << exam1.examDate.day << "." << exam1.examDate.month << "." << exam1.examDate.year << ". \nСписок студентов и оценок:"
- << endl;
- for (int i = 0; i < 25; ++i) {
- cout << "Студент: " << exam1.students[i].lastName << ", номер зачетной книжки: " << exam1.students[i].recordBookNumber << ", оценка: " << exam1.students[i].examGrade << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment