C++ 페어 큐

1 개요[ | ]

C++ 페어 큐
#include <iostream>
#include <queue>
using namespace std;

int main(){
    queue<pair<int,int>> q;
    q.push({1,2});
    q.push({3,4});
    while(!q.empty()) {
        cout << q.front().first << ", ";
        cout << q.front().second << endl;
        q.pop();
    }
}
#include <iostream>
#include <queue>
using namespace std;

int main(){
    queue<pair<int,int>> q;
    q.push(make_pair(1,2));
    q.push(make_pair(3,4));
    while(!q.empty()) {
        cout << q.front().first << ", ";
        cout << q.front().second << endl;
        q.pop();
    }
}
#include <iostream>
#include <queue>
using namespace std;

int main(){
    queue<pair<int,int>> q;
    q.push(pair<int,int>(1,2));
    q.push(pair<int,int>(3,4));
    while(!q.empty()) {
        cout << q.front().first << ", ";
        cout << q.front().second << endl;
        q.pop();
    }
}

2 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}