Search code examples
c++queuepriority-queue

Ask user string input and store in priority queue c++


How do i ask user a string input and store them in a priority queue? I only know how to ask int data type using priority queue


Solution

  • priority_queue<string> q;
    string s;
    cin >> s;
    q.push(s);