#include<iosream.h>
#include<stack.h>
int main()
{
std::stack<char>s;
for(char c='a';c<='f';c++)
{
s.push(c);
}
while (!s.empty())
{
std::cout<<"top element of stack \' "<<s.top()<<"\' "<<std::endl;
s pop();
}
std::cout<<"stack is empty!"<<std::endl;
}
output for this code plz
Answers
Answered by
2
Answer:
f
e
d
c
b
a
stack is empty!
Explanation:
since its declared char, stack would take values starting from a, then b, c, d, e, f.
Similar questions
Social Sciences,
3 months ago
Math,
7 months ago
Physics,
7 months ago
Math,
11 months ago
Math,
11 months ago