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 does I ++ mean in c++?
write a C++ programming using for loop: * * * * * * * * * *
Is c++ map a hash table?
Evaluate as true or false: !(1 &&0 || !1) a) True b) False c) Invalid statement
What are signs of manipulation?
Explain what are the sizes and ranges of the basic c++ data types?
What is atoi?
What gives the current position of the put pointer?
Program to check whether a word is a sub-string or not of a string typed
Is there structure in c++?
When we use Abstract Class and when we use Interface?where we will implement in real time?
How do you differentiate between overloading the prefix and postfix increments?