The Main Functions:
// CPP program to demonstrate working of STL stack
#include
#include
using namespace std;
void showstack(stack
while (!s.empty()) { // That means the stack isn't empty.
cout << 't' << s.top();
s.pop();
}
cout << 'n';
}
int main () {
stack
s.push(10);
s.push(30);
s.push(20);
s.push(5);
s.push(1);
cout << "The stack is : ";
showstack(s);
cout << "ns.size() : " << s.size();
cout << "ns.top() : " << s.top();
cout << "ns.pop() : ";
s.pop();
showstack(s);
return 0;
}
برچسب:
نویسنده: یلدا صفری