Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


implement stack using stack.h headerfile functions



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

Post New Answer

More C++ General Interview Questions

What is size of Empty Class?

3 Answers   Persistent,


Write a single instruction that will find the remainder of integral division when x is divided by y. Have the answer stored in z.

1 Answers  


what Is DCS ? what i will get benefit when i did?

0 Answers  


What is pointer -to-members in C++? Give their syntax?

0 Answers   Honeywell, Zomato,


Can union be self referenced?

0 Answers  


What is name mangling?

3 Answers  


How do you print for example the integers 3,2,1,5,4 in a binary tree within the console in format where it looks like an actual binary tree?

0 Answers  


Can we make any program in c++ without using any header file and what is the shortest program in c++.

0 Answers   MCN Solutions,


What are static variables?

0 Answers  


Write a program using GUI concept for the scheduling algorithms in Operating system like SJF,FCFS etc..

0 Answers  


Describe new operator and delete operator?

0 Answers  


Types of storage and scope of each type

2 Answers   CA,


Categories