fork download
  1. #include <iostream>
  2. #include<bits/stdc++.h>
  3. using namespace std;
  4.  
  5. int main() {
  6. queue<int> a;
  7. int key =2;
  8. int flag = 0;
  9. a.push(1);
  10. a.push(2);
  11. a.push(3);
  12. a.push(4);
  13. a.push(5);
  14. while(!a.empty())
  15. {
  16. cout<<a.back();
  17. // if(a.back()==key)
  18. // {
  19. // flag = 1;
  20. // break;
  21. // }
  22. // else
  23. // {
  24.  
  25. a.pop();
  26.  
  27. }
  28. // if(flag ==1)
  29. // cout<<"1";
  30. // else
  31. // cout<<"-1";
  32. return 0;
  33. }
Success #stdin #stdout 0s 5456KB
stdin
Standard input is empty
stdout
55555