Playground
#include <iostream> #include <stack> using namespace std; int main() { stack<int> s; for (int i=1; i<=5; i++) s.push(i); //q={1, 2, 3, 4, 5} cout << s.size() << endl; //pechati '5' while (!s.empty()) { cout << s.top() << " "; //pechati '5 4 3 2 1 ' s.pop(); } return 0; }
Input data
Program output
no input
Execute
Language: ????????? | Memory: ???? KB | Time: ??? ms
Nothing has been executed, yet!