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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of volatile variable?

1087


How to get the current position of the file pointer?

1049


What are structures and unions?

1009


Out of fgets() and gets() which function is safe to use and why?

1192


What is the output of the following program? Why?

1146


What c++ is used for?

1097


If you hear the cpu fan is running and the monitor power is still on, but you did not see anything show up in the monitor screen. What would you do to find out what is going wrong?

1133


What causes a runtime error c++?

1127


What is the auto keyword good for in c++?

1191


How many different levels of pointers are there?

1215


What is virtual base class?

1083


Write a function to perform the substraction of two numbers. Eg: char N1="123", N2="478", N3=-355(N1-N2).

1001


Differentiate between the message and method in c++?

1075


Do you know what is overriding?

1211


What is function prototyping?

1103