implement stack using stack.h headerfile functions
Answer / sv
#include <iostream>
#include <stack>
using namespace std;
int main()
{
string title;
int howmany;
stack<string> discs;
//Asking the user how many discs he wants to enter in the
stack.
//The loop will rotate that many number of times and then
//prompt the user for input.
cout<<"How many discs :";
cin>>howmany;
for(int i=0;i>title;
//pushing the discs one upon the other
discs.push(title);
}
cout<<"Now at the top of the CD Stack we have :"<<discs.top
()<<endl;
cout<<"The first one entered is "<<endl;
while(!discs.empty())
{
title = discs.top();
discs.pop();
}
cout<<title<<endl;
return 0;
}
| Is This Answer Correct ? | 4 Yes | 4 No |
What is lvalue?
Why c++ is so important?
How can you prevent accessing of the private parts of my class by other programmers (violating encapsulation)?
How do I use turbo c++?
write a C++ programming using for loop: * * * * * * * * * *
What are the effects after calling the delete this operator ?
Why is c++ not purely object oriented?
Why do we use the using declaration?
What are smart pointers?
What is setfill c++?
How much is size of struct having 1 char & 1 integer?
Define precondition and post-condition to a member function?