How to get queue size in C++

1 Answer

0 votes
#include <iostream>
#include <queue>
  
using namespace std; 
    
int main() 
{ 
    queue<int> q;
    int array[5] = {1, 7, 3, 5, 4};
      
    for (int i = 0; i < 5; i++) {
        q.push(array[i]);
    }
  
    cout << q.size();
} 
  
  
  
/*
run:
  
5
  
*/

 



answered Apr 5, 2020 by avibootz

Related questions

1 answer 155 views
155 views asked Apr 15, 2020 by avibootz
1 answer 189 views
2 answers 102 views
1 answer 171 views
1 answer 160 views
1 answer 182 views
182 views asked Apr 5, 2020 by avibootz
1 answer 210 views
...