题解 | #智能排队系统#

智能排队系统

https://www.nowcoder.com/practice/9a1e26180e8d48e69df2f54f3ac303dd

#include <iostream>
#include <deque>
using namespace std;

class Guest {
public:
    string name;
    bool vip;

    Guest(string name, bool vip) {
        this->name = name;
        this->vip = vip;
    }
};

int main() {

    Guest guest1("张三", false);
    Guest guest2("李四", false);
    Guest vipGuest("王五", true);
    deque<Guest> deque;

    // write your code here......
    deque.push_back(guest1);
    deque.push_back(guest2);
    deque.push_front(vipGuest);

    for (Guest g : deque) {
        cout << g.name << " ";
    }

    return 0;
}

全部评论

相关推荐

评论
点赞
收藏
分享
牛客网
牛客企业服务