Computer Science, asked by sakshisakhare42, 7 months ago

#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 druvishvijay
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