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 |
Is c++ an oop?
What is c++ iterator?
What kind of jobs can I get with c++?
Can the operator == be overloaded for comparing two arrays consisting of characters by using string comparison?
How can an improvement in the quality of software be done by try/catch/throw?
Explain rtti.
wrong statement about c++ a)code removably b)encapsulation of data and code c)program easy maintenance d)program runs faster
Write a struct time where integer m, h, s are its members?
What is the latest version on c++?
Write a program which uses functions like strcmp(), strcpy()? etc
What is class invariant in c++?
C++ program output? Explain output of this program. #include <iostream> using std::cout; using std::cin; int main() { cout<<cout<<' '; cout<<cin; return 0; } It prints some address in hexadecimal. what is it?