473,385 Members | 1,521 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Remove contents of a stack

thatos
105 100+
Is the any other way to remove contents of a stack without using the following loop or is there any other way to remove stack contents?
Here is the loop
Expand|Select|Wrap|Line Numbers
  1. Stack s = new Stack();
  2. .
  3. .
  4. .
  5. .
  6. .
  7. while (s.empty == false){
  8. s.pop();
  9. }
  10.  
Apr 17 '08 #1
3 1672
JosAH
11,448 Expert 8TB
Is the any other way to remove contents of a stack without using the following loop or is there any other way to remove stack contents?
Here is the loop
Expand|Select|Wrap|Line Numbers
  1. Stack s = new Stack();
  2. .
  3. .
  4. .
  5. .
  6. .
  7. while (s.empty == false){
  8. s.pop();
  9. }
  10.  
When you read the API docs for a core class such as the Stack class, also read
the API docs of its super class. Pay attention to the clear() method.

kind regards,

Jos
Apr 17 '08 #2
thatos
105 100+
When you read the API docs for a core class such as the Stack class, also read
the API docs of its super class. Pay attention to the clear() method.

kind regards,

Jos
Thanks very much I found lots of informaiton on the API which I previously did not know.
Apr 18 '08 #3
BigDaddyLH
1,216 Expert 1GB
Thanks very much I found lots of informaiton on the API which I previously did not know.
You didn't know about the existence of the API before?
Apr 18 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: CoderGuy | last post by:
Hello I am reading up a bit on how memmory is used in the .NET Framework and have a few question about the stack-based approach * I understand that the stack is used to provide a layer of...
9
by: Ioannis Vranos | last post by:
Here is a similar code to one that I saw in a video on the web: #include <cstdio> #include <cstring> void somefunc(const char *input) { using namespace std;
10
by: cppdev | last post by:
Hi All! I want to clear the string contents from sensitive information such as passwords, and etc. It's always a case that password will appear as string at some point or another. And i feel...
0
by: CoderGuy | last post by:
Hello I am reading up a bit on how memmory is used in the .NET Framework and have a few question about the stack-based approach * I understand that the stack is used to provide a layer of...
1
by: alfie27 | last post by:
I currently have a working program that is a stack that stores integers. Now i have to convert it to store strings instead of integers. I have been working on this for hours and just keep getting...
2
by: Sniper471 | last post by:
Hey, I'm currently using Microsoft Visual Studio 2005 and Visual C++ within it. I need to remove the stack limit (if possible) or at least increase it. How would I go about doing this? ...
9
by: Tarique | last post by:
Hello all.I am trying to implement a stack which can store either integer or float values. The code is given below: #include<stdio.h> #include<stdlib.h> #include<string.h> #define...
3
by: junkchiu | last post by:
want to remove "content" between two corresponding tags. What's the best way of doing it? I want to remove contents between <SEC-HEADER> and <table> tags. I have different tags, and I want to remove...
0
by: tabassumpatil | last post by:
Please send the c code for: 1.STACK OPERATIONS : Transfer the names stored in stack s1 to stack s2 and print the contents of stack s2. 2.QUEUE OPERATIONS : Write a program to implement...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.