Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- namespace {
- class Time {
- private:
- int hours;
- int minutes;
- public:
- Time(int h = 8, int m = 46) : hours(h), minutes(m) {
- }
- int getHours() const {
- return hours;
- }
- int getMinutes() const {
- return minutes;
- }
- void enterTime() {
- std::cout << "Введите время вылета: ";
- std::cin >> hours >> minutes;
- }
- void outputTime() {
- std::cout << "Время вылета:\t" << hours << ':' << minutes << std::endl;
- }
- };
- class Date {
- private:
- int day;
- int month;
- int year;
- public:
- Date(int a = 11, int b = 9, int c = 2001) : day(a), month(b), year(c) {
- }
- int getDay() const {
- return day;
- }
- int getMonth() const {
- return month;
- }
- int getYear() const {
- return year;
- }
- void enterDate() {
- std::cout << "Введите дату вылета: ";
- std::cin >> day >> month >> year;
- }
- void outputDate() {
- std::cout << "Дата вылета:\t" << day << '.' << month << '.' << year << std::endl;
- }
- };
- struct aviabilet {
- std::string nomer;
- std::string punct;
- Time departureTime;
- Date departureDate;
- double cost;
- int mesto;
- };
- aviabilet enterInfo(aviabilet first) {
- std::cout << "Введите номер рейса: ";
- std::cin >> first.nomer;
- std::cout << "Введите пункт назначения: ";
- std::cin >> first.punct;
- first.departureTime.enterTime();
- first.departureDate.enterDate();
- std::cout << "Введите цену билета: ";
- std::cin >> first.cost;
- std::cout << "Введите номер вашего места : ";
- std::cin >> first.mesto;
- return first;
- };
- std::string outputInfo(aviabilet first) {
- std::cout << "Номер рейса:\t" << first.nomer << std::endl;
- std::cout << "Пункт назначения:\t" << first.punct << std::endl;
- first.departureTime.outputTime();
- first.departureDate.outputDate();
- std::cout << "Цена билета:\t" << first.cost << std::endl;
- std::cout << "Номер вашего места:\t" << first.mesto << std::endl;
- return;
- }
- }
- int main() {
- aviabilet first;
- std::setlocale(LC_ALL, "Rus");
- enterInfo(first);
- outputInfo(first);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement