C++实现类和对象:编写一个程序,模拟电梯的功能。功能接口包括电梯上行按钮、下行按钮、楼层选择和电梯在行驶过程中的楼层显示。

浙江理工大学信息学院

面向对象程序设计实验报告

实验名称:类的定义与使用                      学时安排:3

实验类别:设计性实验                             实验要求:1人1组

姓名:杨正龙                                           学号:2020329621193              

 ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄

一、实验目的

1)掌握类的概念、类的定义格式、类与结构的关系、类的成员属性和类的封装性;

2)掌握类对象的定义;

3)理解类的成员的访问控制的含义,公有、私有和保护成员的区别;

4)掌握构造函数和析构函数的含义与作用、定义方式和实现,能够根据要求正确定义和重载构造函数。能够根据给定的要求定义类并实现类的成员函数;

二、实验原理介绍

通过建立类及对象,用类的成员函数和对象访问类的成员;

利用建立类的构造函数,完成类的成员的初始化工作;

三、实验设备介绍

软件需求: Visual Studio C++或Codeblocks或Dev C++或其他C++ IDE

硬件需求: 能够流畅运行C++ IDE的计算机一台。

四、实验内容

编写一个程序,模拟电梯的功能。功能接口包括电梯上行按钮、下行按钮、楼层选择和电梯在行驶过程中的楼层显示。

要求:

1.由用户选择按上行按钮还是下行按钮,选择操作后再由用户输入要进入的楼层,进而电梯开始运行,显示所到的每一楼层层数。

2.如果是上行,则选择输入的楼层好不能比当前楼层号小,否则应给出不合法提示。

3. 如果是下行,则选择输入的楼层好不能比当前楼层号大,否则应给出不合法提示。

4.电梯一旦开始运作就会始终运行,直到窗口关闭。

5.电梯在经过不同楼层时,最好每个楼层的显示之间能有延迟,最终停靠的楼层的输出形式能更加醒目。如果可以,在电梯最初开始运行时,能在电梯由内部显示当前日期(提示:实现这些功能时,需要调用系统api,实现时间显示功能可以使用Date类)。

五 程序清单

data.h:

#pragma once

#include <iostream>

#include<ctime>

#include<cstdlib>

#include<string>

#include<cstdio>

using namespace std;

class CDate {

public:

    CDate(int dd, int mm = 1, int yy = 1999);

    CDate();

    CDate(const CDate& other);

    ~CDate();

    CDate addYear(int n);

    CDate addMonth(int n);

    CDate addDay(int n);

    string format(string df);

    int getDay() const;

    int getMonth() const;

    int getYear() const;

    bool isEquals(CDate date) const;

public:

    int* d, * m, * y;

    int maxDay[2][13] =

{ {0,31,28,31,30,31,30,31,31,30,31,30,31},{0,31,29,31,30,31,30,31,31,30,31,30,31} };

    const string dfs = "ddd";

    const string dfl = "DDD";

};

elevator.h:

#pragma once

#include <iostream>

#include<ctime>

#include<cstdlib>

#include<string>

#include<cstdio>

#include<windows.h>



#define MS 100



using namespace std;



class Elevator {

private:

    int now_floor, want_floor, choice, total_floors;

    void up(int want_floor);

    void down(int want_floor);

    void inputWant_floor();

    void inputChoice();

    void outsideopen();//电梯外开门动画

    void outsideclose();//电梯外关门动画

    void insideopen();//电梯内开门动画

    void insideclose();//电梯内关门动画

    void waitgame();//等待动画

public:

    Elevator(int now_floorr, int total_floorss);

    void control();

    void display();

};

data.cpp:

#include"data.h"

CDate::CDate(int dd, int mm, int yy) :dfs("ddd"), dfl("DDD")    //初始化

{

    if ((yy >= 1000 && yy <= 9999) && (mm >= 1 && mm <= 12) && (dd >= 1 && dd

        <= maxDay[(yy / 4 == 0 && yy / 100 != 0) || (yy / 400 == 0)][mm]))

    {

        y = new int(yy);

        m = new int(mm);

        d = new int(dd);

    }

    else throw "create CDate object error";

}

CDate::CDate() :dfs("ddd"), dfl("DDD")    //初始化

{

    time_t now;

    time(&now);

    struct tm* t_now;

    t_now = localtime(&now);

    y = new int(t_now->tm_year + 1900);

    m = new int(t_now->tm_mon + 1);

    d = new int(t_now->tm_mday);

}

CDate::CDate(const CDate& other)

{

    cout << "CDate::CDate(const CDate &other)" << endl;

    y = new int(*other.y);

    m = new int(*other.m);

    d = new int(*other.d);

}

CDate::~CDate()

{

    cout << "CDate::~CDate()" << endl;

    delete y;

    delete m;

    delete d;

}

CDate CDate::addYear(int n)               //加 n 年

{

    *y += n;

    return *this;

}

CDate CDate::addMonth(int n)              //加 n 月 

{

    *m += n;

    if (*m > 12) {

        *m = *m % 12;

        (*y)++;

    }

    return *this;

}

CDate CDate::addDay(int n)                //加 n 天 

{

    *d += n;

    int dd = maxDay[(*y / 4 == 0 && *y / 100 != 0) || (*y / 400 == 0)][*m];

    if (*d > dd)

    {

        *d = *d % dd;

        (*m)++;

    }

    return *this;

}

string CDate::format(string df)

{

    char c_df[20];

    if (df == dfs)

    {

        sprintf(c_df, "%d-%d-%d", *y, *m, *d);

        return string(c_df);

    }

    if (df == dfl)

    {

        sprintf(c_df, "%d 年%d 月%d 日", *y, *m, *d);

        return string(c_df);

    }

    return string("");

}

int CDate::getDay() const

{

    return *d;

}

int CDate::getMonth() const

{

    return *m;

}

int CDate::getYear() const

{

    return *y;

}

bool CDate::isEquals(CDate date) const

{

    if ((*y == *date.y) && (*m == *date.m) && (*d == *date.d))

        return true;

    else return false;

}



function.cpp:

#include"elevator.h"

void display();

void Exit();

Elevator::Elevator(int now_floorr, int

    total_floorss) :want_floor(0), choice(0)

{

    total_floors = total_floorss;

    now_floor = now_floorr;

    cout << "该电梯一共" << total_floors << "层,欢迎您使用!" <<

        endl << endl;

}



void Elevator::display() {

    cout << "┌───────────┬──────────┐" << endl;

    cout << "│           │          │                    " << endl;

    cout << "│           │          │                    " << endl;

    cout << "│           │          │                    " << endl;

    cout << "│           │          │  ┌───┐        " << endl;

    cout << "│           │          │  │ ▲│ 1.上升           " << endl;

    cout << "│           │          │  │ ▼│ 2.下降           " << endl;

    cout << "│           │          │  └───┘        " << endl;

    cout << "│           │          │                    " << endl;

    cout << "│           │          │                    " << endl;

    cout << "│           │          │                    " << endl;

    cout << "│           │          │                    " << endl;

    cout << "└───────────┴──────────┘" << endl;



}



void Elevator::inputChoice()

{

    cin >> choice;

}



void Elevator::inputWant_floor()

{

    cin >> want_floor;

}



void Elevator::down(int want_floor)

{

    for (now_floor; want_floor < now_floor; now_floor--) {



        system("cls");



        cout << "┌───────────┬──────────┬───────┐" << endl;

        cout << "│           │          │ ┌───┐ │                       " << endl;

        cout << "│           │          │ │ " << now_floor << " │ │     " << endl;

        cout << "│           │          │ │ ▼│ │                          " << endl;

        cout << "│           │          │ └───┘ │                       " << endl;

        cout << "│           │          │┌─────┐│                     " << endl;

        cout << "│           │          ││ ⑨⑩││                          " << endl;

        cout << "│           │          ││ ⑦⑧││                          " << endl;

        cout << "│           │          ││ ⑤⑥││                          " << endl;

        cout << "│           │          ││ ③④││                          " << endl;

        cout << "│           │          ││ ①②││                          " << endl;

        cout << "│           │          │└─────┘│                     " << endl;

        cout << "└───────────┴──────────┴───────┘" << endl;

        Sleep(1000);  //等待1秒



    }



    system("cls");



    cout << "┌───────────┬──────────┬───────┐" << endl;

    cout << "│           │          │ ┌───┐ │                       " << endl;

    cout << "│           │          │ │ " << want_floor << " │ │     " << endl;

    cout << "│           │          │ │ ▼│ │                          " << endl;

    cout << "│           │          │ └───┘ │                       " << endl;

    cout << "│           │          │┌─────┐│                     " << endl;

    cout << "│           │          ││ ⑨⑩││                          " << endl;

    cout << "│           │          ││ ⑦⑧││                          " << endl;

    cout << "│           │          ││ ⑤⑥││                          " << endl;

    cout << "│           │          ││ ③④││                          " << endl;

    cout << "│           │          ││ ①②││                          " << endl;

    cout << "│           │          │└─────┘│                     " << endl;

    cout << "└───────────┴──────────┴───────┘" << endl;

    Sleep(1000);  //等待1秒



    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),

        FOREGROUND_INTENSITY | FOREGROUND_RED);

    cout << "第" << want_floor << "层到了!" << endl << endl;

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),

        FOREGROUND_INTENSITY | FOREGROUND_RED |

        FOREGROUND_GREEN | FOREGROUND_BLUE);

    Sleep(1000);

    system("cls");

    insideopen();

    outsideclose();

    system("cls");

    display();

    control();

}



void Elevator::up(int want_floor)

{

    for (now_floor; now_floor < want_floor; now_floor++) {



        system("cls");



        cout << "┌───────────┬──────────┬───────┐" << endl;

        cout << "│           │          │ ┌───┐ │                       " << endl;

        cout << "│           │          │ │ " << now_floor << " │ │     " << endl;

        cout << "│           │          │ │ ▲│ │                          " << endl;

        cout << "│           │          │ └───┘ │                       " << endl;

        cout << "│           │          │┌─────┐│                     " << endl;

        cout << "│           │          ││ ⑨⑩││                          " << endl;

        cout << "│           │          ││ ⑦⑧││                          " << endl;

        cout << "│           │          ││ ⑤⑥││                          " << endl;

        cout << "│           │          ││ ③④││                          " << endl;

        cout << "│           │          ││ ①②││                          " << endl;

        cout << "│           │          │└─────┘│                     " << endl;

        cout << "└───────────┴──────────┴───────┘" << endl;



        Sleep(1000);  //等待1秒

    }



    system("cls");



    cout << "┌───────────┬──────────┬───────┐" << endl;

    cout << "│           │          │ ┌───┐ │                       " << endl;

    cout << "│           │          │ │ " << want_floor << " │ │     " << endl;

    cout << "│           │          │ │ ▲│ │                          " << endl;

    cout << "│           │          │ └───┘ │                       " << endl;

    cout << "│           │          │┌─────┐│                     " << endl;

    cout << "│           │          ││ ⑨⑩││                          " << endl;

    cout << "│           │          ││ ⑦⑧││                          " << endl;

    cout << "│           │          ││ ⑤⑥││                          " << endl;

    cout << "│           │          ││ ③④││                          " << endl;

    cout << "│           │          ││ ①②││                          " << endl;

    cout << "│           │          │└─────┘│                     " << endl;

    cout << "└───────────┴──────────┴───────┘" << endl;



    Sleep(1000);  //等待1秒



    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),

        FOREGROUND_INTENSITY | FOREGROUND_RED);

    cout << "第" << want_floor << "层到了!" << endl << endl;

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),

        FOREGROUND_INTENSITY | FOREGROUND_RED |

        FOREGROUND_GREEN | FOREGROUND_BLUE);

    Sleep(1000);

    system("cls");

    insideopen();

    outsideclose();

    system("cls");

    display();

    control();

}



void Elevator::control()

{

    inputChoice();

    if (choice == 1) {

        outsideopen();

        system("cls");

        insideclose();

        waitgame();

        cout << "请输入您想去的楼层:" << endl;

        inputWant_floor();



        if (want_floor > 0 && want_floor<total_floors + 1 && want_floor>now_floor) {

            up(want_floor);

            display();

        }

        else if (want_floor<0 || want_floor>total_floors) {

             cout << "该楼层不存在" << endl;

             Sleep(1000);

             system("cls");

             insideopen();

             outsideclose();

             system("cls");

             display();

             control();



        }

        else if (want_floor == now_floor) {

             cout << "您已经在该楼层" << endl;

             Sleep(1000);

             system("cls");

             insideopen();

            outsideclose();

             system("cls");

            display();

             control();

        }

        else {

             cout << " 您 不 能 上 行 !" << endl;

             Sleep(1000);

             system("cls");

             insideopen();

             outsideclose();

             system("cls");

             display();

             control();

        }

        }



    else if (choice == 2) {

        cout << "您当前在第" << now_floor << "层" << endl;

        outsideopen();

        waitgame();

        cout << "请输入您想去的楼层:" << endl;

        inputWant_floor();



            if (want_floor > 0 && want_floor < total_floors + 1 && want_floor < now_floor) {

                down(want_floor);

                display();

            }

             else if (want_floor<0 || want_floor>total_floors) {

                 cout << "该楼层不存在" << endl << endl; display(); control();

                 Sleep(1000);

                 system("cls");

                 insideopen();

                 outsideclose();

                 system("cls");

                 display();

                 control();

             }

            else if (want_floor == now_floor) {

                 cout << "您已经在该楼层" << endl;

                 Sleep(1000);

                 system("cls");

                 insideopen();

                 outsideclose();

                 system("cls");

                 display();

                 control();

            }

             else {

                 cout << " 您 不 能 下 降 !" << endl;

                 Sleep(1000);

                 system("cls");

                 insideopen();

                 outsideclose();

                 system("cls");

                 display();

                 control();

            }

            }



    else if (choice == 3) { Exit(); }



    else {

                cout << "您的选择有误,请重新选择!" << endl << endl;

                 Sleep(1000);

                 system("cls");

                 insideopen();

                 outsideclose();

                 system("cls");

                 display();

                 control();

            }



        }



void Exit()

{

    exit(3);

}



void Elevator::outsideopen() {

    system("cls");



    cout << "┌───────────┬──────────┐" << endl;

    cout << "│           │          │                     " << endl;

    cout << "│           │          │                     " << endl;

    cout << "│           │          │                     " << endl;

    cout << "│           │          │  ┌───┐         " << endl;

    cout << "│           │          │  │ ▲│            " << endl;

    cout << "│           │          │  │ ▼│            " << endl;

    cout << "│           │          │  └───┘         " << endl;

    cout << "│           │          │                     " << endl;

    cout << "│           │          │                     " << endl;

    cout << "│           │          │                     " << endl;

    cout << "│           │          │                     " << endl;

    cout << "└───────────┴──────────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌──────────┬┬──────────┐" << endl;

    cout << "│          ││          │                    " << endl;

    cout << "│          ││          │                    " << endl;

    cout << "│          ││          │                    " << endl;

    cout << "│          ││          │  ┌───┐        " << endl;

    cout << "│          ││          │  │ ▲│           " << endl;

    cout << "│          ││          │  │ ▼│           " << endl;

    cout << "│          ││          │  └───┘        " << endl;

    cout << "│          ││          │                    " << endl;

    cout << "│          ││          │                    " << endl;

    cout << "│          ││          │                    " << endl;

    cout << "│          ││          │                    " << endl;

    cout << "└──────────┴┴──────────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌─────────┬──┬─────────┐" << endl;

    cout << "│         │  │         │                    " << endl;

    cout << "│         │  │         │                    " << endl;

    cout << "│         │  │         │                    " << endl;

    cout << "│         │  │         │  ┌───┐        " << endl;

    cout << "│         │  │         │  │ ▲│           " << endl;

    cout << "│         │  │         │  │ ▼│           " << endl;

    cout << "│         │  │         │  └───┘        " << endl;

    cout << "│         │  │         │                    " << endl;

    cout << "│         │  │         │                    " << endl;

    cout << "│         │  │         │                    " << endl;

    cout << "│         │  │         │                    " << endl;

    cout << "└─────────┴──┴─────────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌────────┬────┬────────┐" << endl;

    cout << "│        │    │        │                    " << endl;

    cout << "│        │    │        │                    " << endl;

    cout << "│        │    │        │                    " << endl;

    cout << "│        │    │        │  ┌───┐        " << endl;

    cout << "│        │    │        │  │ ▲│           " << endl;

    cout << "│        │    │        │  │ ▼│           " << endl;

    cout << "│        │    │        │  └───┘        " << endl;

    cout << "│        │    │        │                    " << endl;

    cout << "│        │    │        │                    " << endl;

    cout << "│        │    │        │                    " << endl;

    cout << "│        │    │        │                    " << endl;

    cout << "└────────┴────┴────────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌───────┬──────┬───────┐" << endl;

    cout << "│       │      │       │                    " << endl;

    cout << "│       │      │       │                    " << endl;

    cout << "│       │      │       │                    " << endl;

    cout << "│       │      │       │  ┌───┐        " << endl;

    cout << "│       │      │       │  │ ▲│           " << endl;

    cout << "│       │      │       │  │ ▼│           " << endl;

    cout << "│       │      │       │  └───┘        " << endl;

    cout << "│       │      │       │                    " << endl;

    cout << "│       │      │       │                    " << endl;

    cout << "│       │      │       │                    " << endl;

    cout << "│       │      │       │                    " << endl;

    cout << "└───────┴──────┴───────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌──────┬────────┬──────┐" << endl;

    cout << "│      │        │      │                    " << endl;

    cout << "│      │        │      │                    " << endl;

    cout << "│      │        │      │                    " << endl;

    cout << "│      │        │      │  ┌───┐        " << endl;

    cout << "│      │        │      │  │ ▲│           " << endl;

    cout << "│      │        │      │  │ ▼│           " << endl;

    cout << "│      │        │      │  └───┘        " << endl;

    cout << "│      │        │      │                    " << endl;

    cout << "│      │        │      │                    " << endl;

    cout << "│      │        │      │                    " << endl;

    cout << "│      │        │      │                    " << endl;

    cout << "└──────┴────────┴──────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌─────┬──────────┬─────┐" << endl;

    cout << "│     │          │     │                    " << endl;

    cout << "│     │          │     │                    " << endl;

    cout << "│     │          │     │                    " << endl;

    cout << "│     │          │     │  ┌───┐        " << endl;

    cout << "│     │          │     │  │ ▲│           " << endl;

    cout << "│     │          │     │  │ ▼│           " << endl;

    cout << "│     │          │     │  └───┘        " << endl;

    cout << "│     │          │     │                    " << endl;

    cout << "│     │          │     │                    " << endl;

    cout << "│     │          │     │                    " << endl;

    cout << "│     │          │     │                    " << endl;

    cout << "└─────┴──────────┴─────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌────┬────────────┬────┐" << endl;

    cout << "│    │            │    │                    " << endl;

    cout << "│    │            │    │                    " << endl;

    cout << "│    │            │    │                    " << endl;

    cout << "│    │            │    │  ┌───┐        " << endl;

    cout << "│    │            │    │  │ ▲│           " << endl;

    cout << "│    │            │    │  │ ▼│           " << endl;

    cout << "│    │            │    │  └───┘        " << endl;

    cout << "│    │            │    │                    " << endl;

    cout << "│    │            │    │                    " << endl;

    cout << "│    │            │    │                    " << endl;

    cout << "│    │            │    │                    " << endl;

    cout << "└────┴────────────┴────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌───┬──────────────┬───┐" << endl;

    cout << "│   │              │   │                    " << endl;

    cout << "│   │              │   │                    " << endl;

    cout << "│   │              │   │                    " << endl;

    cout << "│   │              │   │  ┌───┐        " << endl;

    cout << "│   │              │   │  │ ▲│           " << endl;

    cout << "│   │              │   │  │ ▼│           " << endl;

    cout << "│   │              │   │  └───┘        " << endl;

    cout << "│   │              │   │                    " << endl;

    cout << "│   │              │   │                    " << endl;

    cout << "│   │              │   │                    " << endl;

    cout << "│   │              │   │                    " << endl;

    cout << "└───┴──────────────┴───┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌──┬────────────────┬──┐" << endl;

    cout << "│  │                │  │                    " << endl;

    cout << "│  │                │  │                    " << endl;

    cout << "│  │                │  │                    " << endl;

    cout << "│  │                │  │  ┌───┐        " << endl;

    cout << "│  │                │  │  │ ▲│           " << endl;

    cout << "│  │                │  │  │ ▼│           " << endl;

    cout << "│  │                │  │  └───┘        " << endl;

    cout << "│  │                │  │                    " << endl;

    cout << "│  │                │  │                    " << endl;

    cout << "│  │                │  │                    " << endl;

    cout << "│  │                │  │                    " << endl;

    cout << "└──┴────────────────┴──┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌─┬──────────────────┬─┐" << endl;

    cout << "│ │                  │ │                    " << endl;

    cout << "│ │                  │ │                    " << endl;

    cout << "│ │                  │ │                    " << endl;

    cout << "│ │                  │ │  ┌───┐        " << endl;

    cout << "│ │                  │ │  │ ▲│           " << endl;

    cout << "│ │                  │ │  │ ▼│           " << endl;

    cout << "│ │                  │ │  └───┘        " << endl;

    cout << "│ │                  │ │                    " << endl;

    cout << "│ │                  │ │                    " << endl;

    cout << "│ │                  │ │                    " << endl;

    cout << "│ │                  │ │                    " << endl;

    cout << "└─┴──────────────────┴─┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌┬────────────────────┬┐" << endl;

    cout << "││                    ││                    " << endl;

    cout << "││                    ││                    " << endl;

    cout << "││                    ││                    " << endl;

    cout << "││                    ││  ┌───┐        " << endl;

    cout << "││                    ││  │ ▲│           " << endl;

    cout << "││                    ││  │ ▼│           " << endl;

    cout << "││                    ││  └───┘        " << endl;

    cout << "││                    ││                    " << endl;

    cout << "││                    ││                    " << endl;

    cout << "││                    ││                    " << endl;

    cout << "││                    ││                    " << endl;

    cout << "└┴────────────────────┴┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌──────────────────────┐" << endl;

    cout << "│                      │                      " << endl;

    cout << "│                      │                      " << endl;

    cout << "│                      │                      " << endl;

    cout << "│                      │  ┌───┐          " << endl;

    cout << "│                      │  │ ▲│             " << endl;

    cout << "│                      │  │ ▼│             " << endl;

    cout << "│                      │  └───┘          " << endl;

    cout << "│                      │                      " << endl;

    cout << "│                      │                      " << endl;

    cout << "│                      │                      " << endl;

    cout << "│                      │                      " << endl;

    cout << "└──────────────────────┘" << endl;







}



void Elevator::insideopen() {

    system("cls");



    cout << "┌───────────┬──────────┬───────┐" << endl;

    cout << "│           │          │ ┌───┐ │                       " << endl;

    cout << "│           │          │ │ " << now_floor << " │ │        " << endl;

    cout << "│           │          │ │ * │ │                          " << endl;

    cout << "│           │          │ └───┘ │                       " << endl;

    cout << "│           │          │┌─────┐│                     " << endl;

    cout << "│           │          ││ ⑨⑩││                          " << endl;

    cout << "│           │          ││ ⑦⑧││                          " << endl;

    cout << "│           │          ││ ⑤⑥││                          " << endl;

    cout << "│           │          ││ ③④││                          " << endl;

    cout << "│           │          ││ ①②││                          " << endl;

    cout << "│           │          │└─────┘│                     " << endl;

    cout << "└───────────┴──────────┴───────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌──────────┬┬──────────┬───────┐" << endl;

    cout << "│          ││          │ ┌───┐ │                      " << endl;

    cout << "│          ││          │ │ " << now_floor << " │ │       " << endl;

    cout << "│          ││          │ │ * │ │                         " << endl;

    cout << "│          ││          │ └───┘ │                      " << endl;

    cout << "│          ││          │┌─────┐│                    " << endl;

    cout << "│          ││          ││ ⑨⑩││                         " << endl;

    cout << "│          ││          ││ ⑦⑧││                         " << endl;

    cout << "│          ││          ││ ⑤⑥││                         " << endl;

    cout << "│          ││          ││ ③④││                         " << endl;

    cout << "│          ││          ││ ①②││                         " << endl;

    cout << "│          ││          │└─────┘│                    " << endl;

    cout << "└──────────┴┴──────────┴───────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌─────────┬──┬─────────┬───────┐" << endl;

    cout << "│         │  │         │ ┌───┐ │                      " << endl;

    cout << "│         │  │         │ │ " << now_floor << " │ │       " << endl;

    cout << "│         │  │         │ │ * │ │                         " << endl;

    cout << "│         │  │         │ └───┘ │                      " << endl;

    cout << "│         │  │         │┌─────┐│                    " << endl;

    cout << "│         │  │         ││ ⑨⑩││                         " << endl;

    cout << "│         │  │         ││ ⑦⑧││                         " << endl;

    cout << "│         │  │         ││ ⑤⑥││                         " << endl;

    cout << "│         │  │         ││ ③④││                         " << endl;

    cout << "│         │  │         ││ ①②││                         " << endl;

    cout << "│         │  │         │└─────┘│                    " << endl;

    cout << "└─────────┴──┴─────────┴───────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌────────┬────┬────────┬───────┐" << endl;

    cout << "│        │    │        │ ┌───┐ │                      " << endl;

    cout << "│        │    │        │ │ " << now_floor << " │ │       " << endl;

    cout << "│        │    │        │ │ * │ │                         " << endl;

    cout << "│        │    │        │ └───┘ │                      " << endl;

    cout << "│        │    │        │┌─────┐│                    " << endl;

    cout << "│        │    │        ││ ⑨⑩││                         " << endl;

    cout << "│        │    │        ││ ⑦⑧││                         " << endl;

    cout << "│        │    │        ││ ⑤⑥││                         " << endl;

    cout << "│        │    │        ││ ③④││                         " << endl;

    cout << "│        │    │        ││ ①②││                         " << endl;

    cout << "│        │    │        │└─────┘│                    " << endl;

    cout << "└────────┴────┴────────┴───────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌───────┬──────┬───────┬───────┐" << endl;

    cout << "│       │      │       │ ┌───┐ │                      " << endl;

    cout << "│       │      │       │ │ " << now_floor << " │ │       " << endl;

    cout << "│       │      │       │ │ * │ │                         " << endl;

    cout << "│       │      │       │ └───┘ │                      " << endl;

    cout << "│       │      │       │┌─────┐│                    " << endl;

    cout << "│       │      │       ││ ⑨⑩││                         " << endl;

    cout << "│       │      │       ││ ⑦⑧││                         " << endl;

    cout << "│       │      │       ││ ⑤⑥││                         " << endl;

    cout << "│       │      │       ││ ③④││                         " << endl;

    cout << "│       │      │       ││ ①②││                         " << endl;

    cout << "│       │      │       │└─────┘│                    " << endl;

    cout << "└───────┴──────┴───────┴───────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌──────┬────────┬──────┬───────┐" << endl;

    cout << "│      │        │      │ ┌───┐ │                      " << endl;

    cout << "│      │        │      │ │ " << now_floor << " │ │       " << endl;

    cout << "│      │        │      │ │ * │ │                         " << endl;

    cout << "│      │        │      │ └───┘ │                      " << endl;

    cout << "│      │        │      │┌─────┐│                    " << endl;

    cout << "│      │        │      ││ ⑨⑩││                         " << endl;

    cout << "│      │        │      ││ ⑦⑧││                         " << endl;

    cout << "│      │        │      ││ ⑤⑥││                         " << endl;

    cout << "│      │        │      ││ ③④││                         " << endl;

    cout << "│      │        │      ││ ①②││                         " << endl;

    cout << "│      │        │      │└─────┘│                    " << endl;

    cout << "└──────┴────────┴──────┴───────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌─────┬──────────┬─────┬───────┐" << endl;

    cout << "│     │          │     │ ┌───┐ │                      " << endl;

    cout << "│     │          │     │ │ " << now_floor << " │ │       " << endl;

    cout << "│     │          │     │ │ * │ │                         " << endl;

    cout << "│     │          │     │ └───┘ │                      " << endl;

    cout << "│     │          │     │┌─────┐│                    " << endl;

    cout << "│     │          │     ││ ⑨⑩││                         " << endl;

    cout << "│     │          │     ││ ⑦⑧││                         " << endl;

    cout << "│     │          │     ││ ⑤⑥││                         " << endl;

    cout << "│     │          │     ││ ③④││                         " << endl;

    cout << "│     │          │     ││ ①②││                         " << endl;

    cout << "│     │          │     │└─────┘│                    " << endl;

    cout << "└─────┴──────────┴─────┴───────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌────┬────────────┬────┬───────┐" << endl;

    cout << "│    │            │    │ ┌───┐ │                      " << endl;

    cout << "│    │            │    │ │ " << now_floor << " │ │       " << endl;

    cout << "│    │            │    │ │ * │ │                         " << endl;

    cout << "│    │            │    │ └───┘ │                      " << endl;

    cout << "│    │            │    │┌─────┐│                    " << endl;

    cout << "│    │            │    ││ ⑨⑩││                         " << endl;

    cout << "│    │            │    ││ ⑦⑧││                         " << endl;

    cout << "│    │            │    ││ ⑤⑥││                         " << endl;

    cout << "│    │            │    ││ ③④││                         " << endl;

    cout << "│    │            │    ││ ①②││                         " << endl;

    cout << "│    │            │    │└─────┘│                    " << endl;

    cout << "└────┴────────────┴────┴───────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌───┬──────────────┬───┬───────┐" << endl;

    cout << "│   │              │   │ ┌───┐ │                      " << endl;

    cout << "│   │              │   │ │ " << now_floor << " │ │       " << endl;

    cout << "│   │              │   │ │ * │ │                         " << endl;

    cout << "│   │              │   │ └───┘ │                      " << endl;

    cout << "│   │              │   │┌─────┐│                    " << endl;

    cout << "│   │              │   ││ ⑨⑩││                         " << endl;

    cout << "│   │              │   ││ ⑦⑧││                         " << endl;

    cout << "│   │              │   ││ ⑤⑥││                         " << endl;

    cout << "│   │              │   ││ ③④││                         " << endl;

    cout << "│   │              │   ││ ①②││                         " << endl;

    cout << "│   │              │   │└─────┘│                    " << endl;

    cout << "└───┴──────────────┴───┴───────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌──┬────────────────┬──┬───────┐" << endl;

    cout << "│  │                │  │ ┌───┐ │                      " << endl;

    cout << "│  │                │  │ │ " << now_floor << " │ │       " << endl;

    cout << "│  │                │  │ │ * │ │                         " << endl;

    cout << "│  │                │  │ └───┘ │                      " << endl;

    cout << "│  │                │  │┌─────┐│                    " << endl;

    cout << "│  │                │  ││ ⑨⑩││                         " << endl;

    cout << "│  │                │  ││ ⑦⑧││                         " << endl;

    cout << "│  │                │  ││ ⑤⑥││                         " << endl;

    cout << "│  │                │  ││ ③④││                         " << endl;

    cout << "│  │                │  ││ ①②││                         " << endl;

    cout << "│  │                │  │└─────┘│                    " << endl;

    cout << "└──┴────────────────┴──┴───────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌─┬──────────────────┬─┬───────┐" << endl;

    cout << "│ │                  │ │ ┌───┐ │                      " << endl;

    cout << "│ │                  │ │ │ " << now_floor << " │ │       " << endl;

    cout << "│ │                  │ │ │ * │ │                         " << endl;

    cout << "│ │                  │ │ └───┘ │                      " << endl;

    cout << "│ │                  │ │┌─────┐│                    " << endl;

    cout << "│ │                  │ ││ ⑨⑩││                         " << endl;

    cout << "│ │                  │ ││ ⑦⑧││                         " << endl;

    cout << "│ │                  │ ││ ⑤⑥││                         " << endl;

    cout << "│ │                  │ ││ ③④││                         " << endl;

    cout << "│ │                  │ ││ ①②││                         " << endl;

    cout << "│ │                  │ │└─────┘│                    " << endl;

    cout << "└─┴──────────────────┴─┴───────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌┬────────────────────┬┬───────┐" << endl;

    cout << "││                    ││ ┌───┐ │                      " << endl;

    cout << "││                    ││ │ " << now_floor << " │ │       " << endl;

    cout << "││                    ││ │ * │ │                         " << endl;

    cout << "││                    ││ └───┘ │                      " << endl;

    cout << "││                    ││┌─────┐│                    " << endl;

    cout << "││                    │││ ⑨⑩││                         " << endl;

    cout << "││                    │││ ⑦⑧││                         " << endl;

    cout << "││                    │││ ⑤⑥││                         " << endl;

    cout << "││                    │││ ③④││                         " << endl;

    cout << "││                    │││ ①②││                         " << endl;

    cout << "││                    ││└─────┘│                    " << endl;

    cout << "└┴────────────────────┴┴───────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌──────────────────────┬───────┐" << endl;

    cout << "│                      │ ┌───┐ │                        " << endl;

    cout << "│                      │ │ " << now_floor << " │ │         " << endl;

    cout << "│                      │ │ * │ │                           " << endl;

    cout << "│                      │ └───┘ │                        " << endl;

    cout << "│                      │┌─────┐│                      " << endl;

    cout << "│                      ││ ⑨⑩││                           " << endl;

    cout << "│                      ││ ⑦⑧││                           " << endl;

    cout << "│                      ││ ⑤⑥││                           " << endl;

    cout << "│                      ││ ③④││                           " << endl;

    cout << "│                      ││ ①②││                           " << endl;

    cout << "│                      │└─────┘│                      " << endl;

    cout << "└──────────────────────┴───────┘" << endl;



    system("cls");



}



void Elevator::outsideclose() {

    system("cls");



    cout << "┌──────────────────────┐" << endl;

    cout << "│                      │                      " << endl;

    cout << "│                      │                      " << endl;

    cout << "│                      │                      " << endl;

    cout << "│                      │  ┌───┐          " << endl;

    cout << "│                      │  │ ▲│             " << endl;

    cout << "│                      │  │ ▼│             " << endl;

    cout << "│                      │  └───┘          " << endl;

    cout << "│                      │                      " << endl;

    cout << "│                      │                      " << endl;

    cout << "│                      │                      " << endl;

    cout << "│                      │                      " << endl;

    cout << "└──────────────────────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌┬────────────────────┬┐" << endl;

    cout << "││                    ││                    " << endl;

    cout << "││                    ││                    " << endl;

    cout << "││                    ││                    " << endl;

    cout << "││                    ││  ┌───┐        " << endl;

    cout << "││                    ││  │ ▲│           " << endl;

    cout << "││                    ││  │ ▼│           " << endl;

    cout << "││                    ││  └───┘        " << endl;

    cout << "││                    ││                    " << endl;

    cout << "││                    ││                    " << endl;

    cout << "││                    ││                    " << endl;

    cout << "││                    ││                    " << endl;

    cout << "└┴────────────────────┴┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌─┬──────────────────┬─┐" << endl;

    cout << "│ │                  │ │                    " << endl;

    cout << "│ │                  │ │                    " << endl;

    cout << "│ │                  │ │                    " << endl;

    cout << "│ │                  │ │  ┌───┐        " << endl;

    cout << "│ │                  │ │  │ ▲│           " << endl;

    cout << "│ │                  │ │  │ ▼│           " << endl;

    cout << "│ │                  │ │  └───┘        " << endl;

    cout << "│ │                  │ │                    " << endl;

    cout << "│ │                  │ │                    " << endl;

    cout << "│ │                  │ │                    " << endl;

    cout << "│ │                  │ │                    " << endl;

    cout << "└─┴──────────────────┴─┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌──┬────────────────┬──┐" << endl;

    cout << "│  │                │  │                    " << endl;

    cout << "│  │                │  │                    " << endl;

    cout << "│  │                │  │                    " << endl;

    cout << "│  │                │  │  ┌───┐        " << endl;

    cout << "│  │                │  │  │ ▲│           " << endl;

    cout << "│  │                │  │  │ ▼│           " << endl;

    cout << "│  │                │  │  └───┘        " << endl;

    cout << "│  │                │  │                    " << endl;

    cout << "│  │                │  │                    " << endl;

    cout << "│  │                │  │                    " << endl;

    cout << "│  │                │  │                    " << endl;

    cout << "└──┴────────────────┴──┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌───┬──────────────┬───┐" << endl;

    cout << "│   │              │   │                    " << endl;

    cout << "│   │              │   │                    " << endl;

    cout << "│   │              │   │                    " << endl;

    cout << "│   │              │   │  ┌───┐        " << endl;

    cout << "│   │              │   │  │ ▲│           " << endl;

    cout << "│   │              │   │  │ ▼│           " << endl;

    cout << "│   │              │   │  └───┘        " << endl;

    cout << "│   │              │   │                    " << endl;

    cout << "│   │              │   │                    " << endl;

    cout << "│   │              │   │                    " << endl;

    cout << "│   │              │   │                    " << endl;

    cout << "└───┴──────────────┴───┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌────┬────────────┬────┐" << endl;

    cout << "│    │            │    │                    " << endl;

    cout << "│    │            │    │                    " << endl;

    cout << "│    │            │    │                    " << endl;

    cout << "│    │            │    │  ┌───┐        " << endl;

    cout << "│    │            │    │  │ ▲│           " << endl;

    cout << "│    │            │    │  │ ▼│           " << endl;

    cout << "│    │            │    │  └───┘        " << endl;

    cout << "│    │            │    │                    " << endl;

    cout << "│    │            │    │                    " << endl;

    cout << "│    │            │    │                    " << endl;

    cout << "│    │            │    │                    " << endl;

    cout << "└────┴────────────┴────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌─────┬──────────┬─────┐" << endl;

    cout << "│     │          │     │                    " << endl;

    cout << "│     │          │     │                    " << endl;

    cout << "│     │          │     │                    " << endl;

    cout << "│     │          │     │  ┌───┐        " << endl;

    cout << "│     │          │     │  │ ▲│           " << endl;

    cout << "│     │          │     │  │ ▼│           " << endl;

    cout << "│     │          │     │  └───┘        " << endl;

    cout << "│     │          │     │                    " << endl;

    cout << "│     │          │     │                    " << endl;

    cout << "│     │          │     │                    " << endl;

    cout << "│     │          │     │                    " << endl;

    cout << "└─────┴──────────┴─────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌──────┬────────┬──────┐" << endl;

    cout << "│      │        │      │                    " << endl;

    cout << "│      │        │      │                    " << endl;

    cout << "│      │        │      │                    " << endl;

    cout << "│      │        │      │  ┌───┐        " << endl;

    cout << "│      │        │      │  │ ▲│           " << endl;

    cout << "│      │        │      │  │ ▼│           " << endl;

    cout << "│      │        │      │  └───┘        " << endl;

    cout << "│      │        │      │                    " << endl;

    cout << "│      │        │      │                    " << endl;

    cout << "│      │        │      │                    " << endl;

    cout << "│      │        │      │                    " << endl;

    cout << "└──────┴────────┴──────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌───────┬──────┬───────┐" << endl;

    cout << "│       │      │       │                    " << endl;

    cout << "│       │      │       │                    " << endl;

    cout << "│       │      │       │                    " << endl;

    cout << "│       │      │       │  ┌───┐        " << endl;

    cout << "│       │      │       │  │ ▲│           " << endl;

    cout << "│       │      │       │  │ ▼│           " << endl;

    cout << "│       │      │       │  └───┘        " << endl;

    cout << "│       │      │       │                    " << endl;

    cout << "│       │      │       │                    " << endl;

    cout << "│       │      │       │                    " << endl;

    cout << "│       │      │       │                    " << endl;

    cout << "└───────┴──────┴───────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌────────┬────┬────────┐" << endl;

    cout << "│        │    │        │                    " << endl;

    cout << "│        │    │        │                    " << endl;

    cout << "│        │    │        │                    " << endl;

    cout << "│        │    │        │  ┌───┐        " << endl;

    cout << "│        │    │        │  │ ▲│           " << endl;

    cout << "│        │    │        │  │ ▼│           " << endl;

    cout << "│        │    │        │  └───┘        " << endl;

    cout << "│        │    │        │                    " << endl;

    cout << "│        │    │        │                    " << endl;

    cout << "│        │    │        │                    " << endl;

    cout << "│        │    │        │                    " << endl;

    cout << "└────────┴────┴────────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌─────────┬──┬─────────┐" << endl;

    cout << "│         │  │         │                    " << endl;

    cout << "│         │  │         │                    " << endl;

    cout << "│         │  │         │                    " << endl;

    cout << "│         │  │         │  ┌───┐        " << endl;

    cout << "│         │  │         │  │ ▲│           " << endl;

    cout << "│         │  │         │  │ ▼│           " << endl;

    cout << "│         │  │         │  └───┘        " << endl;

    cout << "│         │  │         │                    " << endl;

    cout << "│         │  │         │                    " << endl;

    cout << "│         │  │         │                    " << endl;

    cout << "│         │  │         │                    " << endl;

    cout << "└─────────┴──┴─────────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌──────────┬┬──────────┐" << endl;

    cout << "│          ││          │                    " << endl;

    cout << "│          ││          │                    " << endl;

    cout << "│          ││          │                    " << endl;

    cout << "│          ││          │  ┌───┐        " << endl;

    cout << "│          ││          │  │ ▲│           " << endl;

    cout << "│          ││          │  │ ▼│           " << endl;

    cout << "│          ││          │  └───┘        " << endl;

    cout << "│          ││          │                    " << endl;

    cout << "│          ││          │                    " << endl;

    cout << "│          ││          │                    " << endl;

    cout << "│          ││          │                    " << endl;

    cout << "└──────────┴┴──────────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌───────────┬──────────┐" << endl;

    cout << "│           │          │                     " << endl;

    cout << "│           │          │                     " << endl;

    cout << "│           │          │                     " << endl;

    cout << "│           │          │  ┌───┐         " << endl;

    cout << "│           │          │  │ ▲│            " << endl;

    cout << "│           │          │  │ ▼│            " << endl;

    cout << "│           │          │  └───┘         " << endl;

    cout << "│           │          │                     " << endl;

    cout << "│           │          │                     " << endl;

    cout << "│           │          │                     " << endl;

    cout << "│           │          │                     " << endl;

    cout << "└───────────┴──────────┘" << endl;



}



void Elevator::insideclose() {

    cout << "┌──────────────────────┬───────┐" << endl;

    cout << "│                      │ ┌───┐ │                        " << endl;

    cout << "│                      │ │ " << now_floor << " │ │         " << endl;

    cout << "│                      │ │ * │ │                           " << endl;

    cout << "│                      │ └───┘ │                        " << endl;

    cout << "│                      │┌─────┐│                      " << endl;

    cout << "│                      ││ ⑨⑩││                           " << endl;

    cout << "│                      ││ ⑦⑧││                           " << endl;

    cout << "│                      ││ ⑤⑥││                           " << endl;

    cout << "│                      ││ ③④││                           " << endl;

    cout << "│                      ││ ①②││                           " << endl;

    cout << "│                      │└─────┘│                      " << endl;

    cout << "└──────────────────────┴───────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌┬────────────────────┬┬───────┐" << endl;

    cout << "││                    ││ ┌───┐ │                      " << endl;

    cout << "││                    ││ │ " << now_floor << " │ │       " << endl;

    cout << "││                    ││ │ * │ │                         " << endl;

    cout << "││                    ││ └───┘ │                      " << endl;

    cout << "││                    ││┌─────┐│                    " << endl;

    cout << "││                    │││ ⑨⑩││                         " << endl;

    cout << "││                    │││ ⑦⑧││                         " << endl;

    cout << "││                    │││ ⑤⑥││                         " << endl;

    cout << "││                    │││ ③④││                         " << endl;

    cout << "││                    │││ ①②││                         " << endl;

    cout << "││                    ││└─────┘│                    " << endl;

    cout << "└┴────────────────────┴┴───────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌─┬──────────────────┬─┬───────┐" << endl;

    cout << "│ │                  │ │ ┌───┐ │                      " << endl;

    cout << "│ │                  │ │ │ " << now_floor << " │ │       " << endl;

    cout << "│ │                  │ │ │ * │ │                         " << endl;

    cout << "│ │                  │ │ └───┘ │                      " << endl;

    cout << "│ │                  │ │┌─────┐│                    " << endl;

    cout << "│ │                  │ ││ ⑨⑩││                         " << endl;

    cout << "│ │                  │ ││ ⑦⑧││                         " << endl;

    cout << "│ │                  │ ││ ⑤⑥││                         " << endl;

    cout << "│ │                  │ ││ ③④││                         " << endl;

    cout << "│ │                  │ ││ ①②││                         " << endl;

    cout << "│ │                  │ │└─────┘│                    " << endl;

    cout << "└─┴──────────────────┴─┴───────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌──┬────────────────┬──┬───────┐" << endl;

    cout << "│  │                │  │ ┌───┐ │                      " << endl;

    cout << "│  │                │  │ │ " << now_floor << " │ │       " << endl;

    cout << "│  │                │  │ │ * │ │                         " << endl;

    cout << "│  │                │  │ └───┘ │                      " << endl;

    cout << "│  │                │  │┌─────┐│                    " << endl;

    cout << "│  │                │  ││ ⑨⑩││                         " << endl;

    cout << "│  │                │  ││ ⑦⑧││                         " << endl;

    cout << "│  │                │  ││ ⑤⑥││                         " << endl;

    cout << "│  │                │  ││ ③④││                         " << endl;

    cout << "│  │                │  ││ ①②││                         " << endl;

    cout << "│  │                │  │└─────┘│                    " << endl;

    cout << "└──┴────────────────┴──┴───────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌───┬──────────────┬───┬───────┐" << endl;

    cout << "│   │              │   │ ┌───┐ │                      " << endl;

    cout << "│   │              │   │ │ " << now_floor << " │ │       " << endl;

    cout << "│   │              │   │ │ * │ │                         " << endl;

    cout << "│   │              │   │ └───┘ │                      " << endl;

    cout << "│   │              │   │┌─────┐│                    " << endl;

    cout << "│   │              │   ││ ⑨⑩││                         " << endl;

    cout << "│   │              │   ││ ⑦⑧││                         " << endl;

    cout << "│   │              │   ││ ⑤⑥││                         " << endl;

    cout << "│   │              │   ││ ③④││                         " << endl;

    cout << "│   │              │   ││ ①②││                         " << endl;

    cout << "│   │              │   │└─────┘│                    " << endl;

    cout << "└───┴──────────────┴───┴───────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌────┬────────────┬────┬───────┐" << endl;

    cout << "│    │            │    │ ┌───┐ │                      " << endl;

    cout << "│    │            │    │ │ " << now_floor << " │ │       " << endl;

    cout << "│    │            │    │ │ * │ │                         " << endl;

    cout << "│    │            │    │ └───┘ │                      " << endl;

    cout << "│    │            │    │┌─────┐│                    " << endl;

    cout << "│    │            │    ││ ⑨⑩││                         " << endl;

    cout << "│    │            │    ││ ⑦⑧││                         " << endl;

    cout << "│    │            │    ││ ⑤⑥││                         " << endl;

    cout << "│    │            │    ││ ③④││                         " << endl;

    cout << "│    │            │    ││ ①②││                         " << endl;

    cout << "│    │            │    │└─────┘│                    " << endl;

    cout << "└────┴────────────┴────┴───────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌─────┬──────────┬─────┬───────┐" << endl;

    cout << "│     │          │     │ ┌───┐ │                      " << endl;

    cout << "│     │          │     │ │ " << now_floor << " │ │       " << endl;

    cout << "│     │          │     │ │ * │ │                         " << endl;

    cout << "│     │          │     │ └───┘ │                      " << endl;

    cout << "│     │          │     │┌─────┐│                    " << endl;

    cout << "│     │          │     ││ ⑨⑩││                         " << endl;

    cout << "│     │          │     ││ ⑦⑧││                         " << endl;

    cout << "│     │          │     ││ ⑤⑥││                         " << endl;

    cout << "│     │          │     ││ ③④││                         " << endl;

    cout << "│     │          │     ││ ①②││                         " << endl;

    cout << "│     │          │     │└─────┘│                    " << endl;

    cout << "└─────┴──────────┴─────┴───────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌──────┬────────┬──────┬───────┐" << endl;

    cout << "│      │        │      │ ┌───┐ │                      " << endl;

    cout << "│      │        │      │ │ " << now_floor << " │ │       " << endl;

    cout << "│      │        │      │ │ * │ │                         " << endl;

    cout << "│      │        │      │ └───┘ │                      " << endl;

    cout << "│      │        │      │┌─────┐│                    " << endl;

    cout << "│      │        │      ││ ⑨⑩││                         " << endl;

    cout << "│      │        │      ││ ⑦⑧││                         " << endl;

    cout << "│      │        │      ││ ⑤⑥││                         " << endl;

    cout << "│      │        │      ││ ③④││                         " << endl;

    cout << "│      │        │      ││ ①②││                         " << endl;

    cout << "│      │        │      │└─────┘│                    " << endl;

    cout << "└──────┴────────┴──────┴───────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌───────┬──────┬───────┬───────┐" << endl;

    cout << "│       │      │       │ ┌───┐ │                      " << endl;

    cout << "│       │      │       │ │ " << now_floor << " │ │       " << endl;

    cout << "│       │      │       │ │ * │ │                         " << endl;

    cout << "│       │      │       │ └───┘ │                      " << endl;

    cout << "│       │      │       │┌─────┐│                    " << endl;

    cout << "│       │      │       ││ ⑨⑩││                         " << endl;

    cout << "│       │      │       ││ ⑦⑧││                         " << endl;

    cout << "│       │      │       ││ ⑤⑥││                         " << endl;

    cout << "│       │      │       ││ ③④││                         " << endl;

    cout << "│       │      │       ││ ①②││                         " << endl;

    cout << "│       │      │       │└─────┘│                    " << endl;

    cout << "└───────┴──────┴───────┴───────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌────────┬────┬────────┬───────┐" << endl;

    cout << "│        │    │        │ ┌───┐ │                      " << endl;

    cout << "│        │    │        │ │ " << now_floor << " │ │       " << endl;

    cout << "│        │    │        │ │ * │ │                         " << endl;

    cout << "│        │    │        │ └───┘ │                      " << endl;

    cout << "│        │    │        │┌─────┐│                    " << endl;

    cout << "│        │    │        ││ ⑨⑩││                         " << endl;

    cout << "│        │    │        ││ ⑦⑧││                         " << endl;

    cout << "│        │    │        ││ ⑤⑥││                         " << endl;

    cout << "│        │    │        ││ ③④││                         " << endl;

    cout << "│        │    │        ││ ①②││                         " << endl;

    cout << "│        │    │        │└─────┘│                    " << endl;

    cout << "└────────┴────┴────────┴───────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌─────────┬──┬─────────┬───────┐" << endl;

    cout << "│         │  │         │ ┌───┐ │                      " << endl;

    cout << "│         │  │         │ │ " << now_floor << " │ │       " << endl;

    cout << "│         │  │         │ │ * │ │                         " << endl;

    cout << "│         │  │         │ └───┘ │                      " << endl;

    cout << "│         │  │         │┌─────┐│                    " << endl;

    cout << "│         │  │         ││ ⑨⑩││                         " << endl;

    cout << "│         │  │         ││ ⑦⑧││                         " << endl;

    cout << "│         │  │         ││ ⑤⑥││                         " << endl;

    cout << "│         │  │         ││ ③④││                         " << endl;

    cout << "│         │  │         ││ ①②││                         " << endl;

    cout << "│         │  │         │└─────┘│                    " << endl;

    cout << "└─────────┴──┴─────────┴───────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌──────────┬┬──────────┬───────┐" << endl;

    cout << "│          ││          │ ┌───┐ │                      " << endl;

    cout << "│          ││          │ │ " << now_floor << " │ │       " << endl;

    cout << "│          ││          │ │ * │ │                         " << endl;

    cout << "│          ││          │ └───┘ │                      " << endl;

    cout << "│          ││          │┌─────┐│                    " << endl;

    cout << "│          ││          ││ ⑨⑩││                         " << endl;

    cout << "│          ││          ││ ⑦⑧││                         " << endl;

    cout << "│          ││          ││ ⑤⑥││                         " << endl;

    cout << "│          ││          ││ ③④││                         " << endl;

    cout << "│          ││          ││ ①②││                         " << endl;

    cout << "│          ││          │└─────┘│                    " << endl;

    cout << "└──────────┴┴──────────┴───────┘" << endl;



    Sleep(MS);

    system("cls");



    cout << "┌───────────┬──────────┬───────┐" << endl;

    cout << "│           │          │ ┌───┐ │                       " << endl;

    cout << "│           │          │ │ " << now_floor << " │ │        " << endl;

    cout << "│           │          │ │ * │ │                          " << endl;

    cout << "│           │          │ └───┘ │                       " << endl;

    cout << "│           │          │┌─────┐│                     " << endl;

    cout << "│           │          ││ ⑨⑩││                          " << endl;

    cout << "│           │          ││ ⑦⑧││                          " << endl;

    cout << "│           │          ││ ⑤⑥││                          " << endl;

    cout << "│           │          ││ ③④││                          " << endl;

    cout << "│           │          ││ ①②││                          " << endl;

    cout << "│           │          │└─────┘│                     " << endl;

    cout << "└───────────┴──────────┴───────┘" << endl;

}



void Elevator::waitgame() {

    system("cls");



    cout << "┌───────────┬──────────┬───────┐" << endl;

    cout << "│           │          │ ┌───┐ │                       " << endl;

    cout << "│           │          │ │ " << now_floor << " │ │        " << endl;

    cout << "│           │          │ │ * │ │                          " << endl;

    cout << "│           │          │ └───┘ │                       " << endl;

    cout << "│           │          │┌─────┐│                     " << endl;

    cout << "│           │          ││ ⑨⑩││                          " << endl;

    cout << "│           │          ││ ⑦⑧││                          " << endl;

    cout << "│           │          ││ ⑤⑥││                          " << endl;

    cout << "│           │          ││ ③④││                          " << endl;

    cout << "│           │          ││ ①②││                          " << endl;

    cout << "│           │          │└─────┘│                     " << endl;

    cout << "└───────────┴──────────┴───────┘" << endl;

}

main.cpp:

#include"elevator.h"

#include"data.h"

int main()

{

    CDate today;

    cout << "┌───────────┬──────────┐" << endl;

    cout << "│           │          │                    " << endl;

    cout << "│           │          │                    " << endl;

    cout << "│           │          │                    " << endl;

    cout << "│           │          │  ┌───┐        " << endl;

    cout << "│           │          │  │ ▲│ 1.上升           " << endl;

    cout << "│           │          │  │ ▼│ 2.下降           " << endl;

    cout << "│           │          │  └───┘        " << endl;

    cout << "│           │          │                    " << endl;

    cout << "│           │          │                    " << endl;

    cout << "│           │          │                    " << endl;

    cout << "│           │          │                    " << endl;

    cout << "└───────────┴──────────┘" << endl;

    cout << "今天是" << today.format("DDD") << endl;

    Elevator elevator(1, 10);

    elevator.control();

    return 0;

}

六 运行结果

七 实验心得

思路:为了实现电梯开合的动画,选择了和传统电影相同的视觉暂留原理,一帧一帧完成画面并封装成函数,放在function头文件里。之后电梯主要逻辑的实现封装成control函数也放在function头文件里,其他函数同理。类的定义和一些基础的头文件放在elevator头文件里。日期的实现整体放在data里,不干扰主函数的代码。最后main函数里面放接口,实现整个电梯运行程序。

心得:电梯的实现,类的定义是关键,哪些公有哪些私有要明确。接口一定要合理并且符合逻辑。最后善用清屏把动画完成流畅即可。

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
1 、结构体与类的编写: (A)利用struct关键字定义一个学生结构体(包括学号、姓名、性别):类名:student, num、name、sex,在主函数定义两个对象stud1,stud2,对stud1对象赋值并输出,对第2个对象stud2赋值输出; (B)利用class关键字将1改成类的编写,其它不变 (C)将输出封装成display,输入封装成setdata函数,分别在类里面定义2函数,在主函数输入输出; (D)将上面两成员函数移至类外定义并输出 (E)将setdata函数利用对象的引用做函数参数,在主函数输入输出 2、(1)定义一个时间类,属性包括小时、分、秒,定义两成员函数:settime,showtime,分别以两种方式、类内定义成员函数和内外定义成员函数 (2)对1两成员函数分别利用对象的引用做参数、默认参数做参数进行编写与调用并输出。属性 3、编写一个程序模拟电梯功能功能接口包括电梯上行按钮下行按钮楼层选择电梯行驶过程楼层显示。 要求: (1)、由用户选择上行按钮还是下行按钮选择操作后再由用户输入要进入的楼层,进而电梯开始运行,显示所到的每一楼层层数。 (2).如果是上行,则选择输入的楼层号不能比当前楼层号小,否则应给出不合法提示。 (3). 如果是下行,则选择输入的楼层号不能比当前楼层号大,否则应给出不合法提示。 (4).电梯一旦开始运作就会始终运行,直到窗口关闭。 (5).电梯在经过不同楼层时,最好每个楼层显示之间能有延迟,最终停靠的楼层的输出形式能更加醒目。如果可以,在电梯最初开始运行时,能在电梯由内部显示当前日期(提示:实现这些功能时,需要调用系统api,实现时间显示功能可以使用CDate类)。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值