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 |
Explain selection sorting. Also write an example.
Do we have private destructors?
What are the main differences between C and C++?
Explain function overloading and operator overloading.
difference between the c++ and c languages
What is #include ctype h in c++?
Which is best ide for c++?
Write a C++ program which will compute the volume of a sphere or a cylinder after prompting the user to type the first character for the shape name.
0 Answers An-Najah National University,
Write a program in C++ for Fibonacci series
0 Answers Axtria, ITC Indian Tobacco Company,
Which recursive sorting technique always makes recursive calls to sort subarrays that are about half size of the original array?
What are friend classes?
Define pointers?