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...

write a program in c++ to implement stack using functions
in header file stack.h

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 ?    31 Yes 29 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Tell me what are static member functions?

1076


Explain the differences between list x; & list x();.

1005


How java is different from c and c++?

1192


What is the difference between strcpy() and strncpy()?

1137


Define anonymous class.

1066


How can you differentiate between inheritance and implementation in c++?

1206


What are the rules for naming an identifier?

1061


What is function overloading in C++?

1417


How can I learn dev c++ programming?

1039


What is ctime c++?

1121


In which header file does one find isalpha() a) conio.h b) stdio.h c) ctype.h

1205


Explain the difference between new() and malloc() in c++?

1129


What does count ++ do in c++?

1197


Explain the difference between c++ and java.

1106


Is std :: string immutable?

1030