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 |
Do you know the use of vtable?
How do I write a c++ program?
what is C++ objects?
How many pointers are required to reverse a link list?
Where is atoi defined?
What is the role of C++ shorthand's?
Mention the storage classes in c++.
What is malloc in c++?
What is a mutable member?
Difference between a homogeneous and a heterogeneous container
How do pointers work?
Is swift faster than c++?