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 are the new features that iso/ansi c++ has added to original c++ specifications?
What are the advantages of using typedef in a program?
How do I open binary files?
Write a corrected statement in c++ so that the statement will work properly. x =+ 7;
Write about the various sections of the executable image?
What is the benefit of learning c++?
Is there structure in c++?
What does h mean in maths?
Implement stack operations with pointers with appropriate exception checks.
What is ctime c++?
What is unary operator? List out the different operators involved in the unary operator.
what is scupper?