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 is the prototype of printf function?
What is the difference between c++ and turbo c++?
Explain function overloading and operator overloading.
Is c++ primer good for beginners?
In inline " expression passed as argument are evalauated once " while in macro "in some cases expression passed as argument are evaluated more than once " --> i am not getting it plz help to make me understand....
0 Answers College School Exams Tests, CS,
class HasStatic { static int I; }; Referring to the sample code above, what is the appropriate method of defining the member variable "I", and assigning it the value 10, outside of the class declaration? a) HasStatic I = 10; b) int static I = 10; c) static I(10); d) static I = 10; e) int HasStatic::I = 10;
What are smart pointer? Whats its use?
What is the most powerful coding language?
Write a program using GUI concept for the scheduling algorithms in Operating system like SJF,FCFS etc..
Define linked lists with the help of an example.
What's the "software peter principle”?
Are vectors passed by reference c++?