Menu
Menu
DaniWeb
Log In
Sign Up
Read
Contribute
Meet
Search
Search
About 65 results for
charstack
- Page 1
Help with CharStack() pop() and push()
Programming
Software Development
13 Years Ago
by vishal1949
I just wanted to know what would happen if you abuse the
CharStack
class by pop()ing more characters than you push()? Would it be an error of out of exception or something else.
Re: Help with CharStack() pop() and push()
Programming
Software Development
13 Years Ago
by JamesCherrill
Which
CharStack
class would that be?
Re: Help with CharStack() pop() and push()
Programming
Software Development
13 Years Ago
by hfx642
Agreed... I don't find any documentation about a class called
CharStack
. A stack (of any type) is a list construct the programmer must create via array.
using charStack();
Programming
Software Development
13 Years Ago
by vishal1949
… could enter are 20 or 25000 lbs. I wrote the
charstack
and the pop() and the push() but dont know how…
Re: Help with CharStack() pop() and push()
Programming
Software Development
13 Years Ago
by Ezzaral
Read the API docs for the class.
Re: Help with CharStack() pop() and push()
Programming
Software Development
13 Years Ago
by hfx642
Besides... Your code should be checking not to pop() if there are 0 elements in your stack.
Re: Help with CharStack() pop() and push()
Programming
Software Development
13 Years Ago
by JamesCherrill
So this is a class that you have written / must write? In that case the answer to your original Q is "that's up to you". Throwing an Exception would be a reasonable thing to do, because it would be an error.
Re: using charStack();
Programming
Software Development
13 Years Ago
by nmaillet
You need to go through a Java tutorial. Couple things from a glance: Each class/interface needs to defined in its own JAVA file, with the same name. For instance, SaturnSL1 must be in a file called SaturnSL1.java. You should be declaring the ParkingGarage class outside of the main method().
Re: using charStack();
Programming
Software Development
13 Years Ago
by hfx642
You have to keep track of two things. a) The number of vehicles in the stack b) The total weight of the vehicles in the stack When you push()/pop(), add/subtract your count/weight. BEFORE you push()/pop(), check for your upper/lower limits. You can't pop() when you have 0 elements. You can't push() when you have 20 elements, or if the added …
Re: using charStack();
Programming
Software Development
13 Years Ago
by raymagosi
first of all i think you need to understand the concept of overflow and underflow. These two will help you understand your problem, before you push() or pop() you have to use a condition to check the number of vehicles in a stack as well as the the total wight.For more information on this problem get any book of [B]DATA STRUCTURE AND ALGORITHMS[/B…
Expert advice on DIY stacks please...
Programming
Software Development
13 Years Ago
by garu525
…bool full ( const
charStack
& ); bool empty ( const
charStack
& ); void push (
charStack
&, char ); char pop (
charStack
& ); char top (
charStack
& ); bool …msg << endl; cin.get(); exit ( EXIT_FAILURE ); } void initialize (
charStack
& stack ) { char *newParens; newParens = (char *) malloc(sizeof(char)…
C++ stack
Programming
Software Development
10 Years Ago
by TObannion
…top; int count; public: //constructor
CharStack
(char); //not written inline ~
CharStack
() //written inline { delete[]stackArray;…(); bool isEmpty(); char getCount(); }; //function definitions //constructor
CharStack
::
CharStack
(char size) { count = 0; stackArray = new char…
custom made queue/stack - having problems
Programming
Software Development
16 Years Ago
by JAGgededgeOB172
…s); void pop(); bool empty(); char top(); };
charstack
::
charstack
() { stack_top = 0; for(int count_1 = 0;…lt; endl; return; } stack_top--; return; } bool
charstack
::empty() { if(stack_top == 0) return true; else…
Re: custom made queue/stack - having problems
Programming
Software Development
16 Years Ago
by JAGgededgeOB172
…bool empty(); char top(); };
charstack
::
charstack
() { head_chrstck = NULL; } void
charstack
::push(char &s) {… temp1_chrstck->next = temp_chrstck; } return; } void
charstack
::pop() { if(head_chrstck == NULL) return; else { …
Re: C++ stack
Programming
Software Development
10 Years Ago
by TObannion
… to test the IntStack class. //Feb 17, 2015 #include "
CharStack
.h" #include<iostream> using namespace std; int… main() { //declare an instance of
CharStack
, size 5, called mystack1
CharStack
mystack1(5); char a='1',b='2',c…
Re: C++ stack
Programming
Software Development
10 Years Ago
by Nutster
The problem is on line 14 of the
CharStack
driver program. You are assigning integers to char. You might …
Throwing an exception
Programming
Software Development
13 Years Ago
by vishal1949
… char[] m_data; // See Note #1 below private int m_ptr; public
CharStack
(int size) { m_ptr = 0; // Note #2 m_data = new char[(… #5 public static void main(String[] argv) throws IOException {
CharStack
s = new
CharStack
(10); int i; while ( (i = System.in.read()) != -1…
Re: Throwing an exception
Programming
Software Development
13 Years Ago
by vishal1949
… could you check. [CODE]package
charstack
; import java.io.*; public class
CharStack
{ private char[] m_data; private int… } public static void main(String[] argv) throws IOException {
CharStack
s = new
CharStack
(10); int i; while ( (i = System.in.read…
error processing templates
Programming
Software Development
13 Years Ago
by custurd122000
…;double> stack(100); MyStack<char>
charStack
(100); MyQueue<string> input(100); cout … ii = 0; ii < token.length(); ++ii)
charStack
.push(token[ii]); inFile >> token; } inFile.…;< "Input reversed is: "; while(!
charStack
.isEmpty()) { cout <<
charStack
.pop() << " "; }…
I created another Stack that tells if word is palindrome, need help
Programming
Software Development
19 Years Ago
by visual one
… len = input.length(); i < len; ++i) {
charStack
.push(input.charAt(i)); } } private String buildReverse() { StringBuilder …result = new StringBuilder(); while (! charaStack.empty()) { result.append(
charStack
.pop()); } return result.toString(); } public boolean isPalindrome() {…
Debug Assertion Error
Programming
Software Development
15 Years Ago
by tyliang
… *calcPtr,queue *queuePtr,char op); int main(void) { stack
charstack
; queue postfix; calc numstack; char expression[MAXSIZE]; float value; initStack…(&
charstack
); initQueue(&postfix); initCalc(&numstack); printf("Please enter…
Palindrome using stacks
Programming
Software Development
14 Years Ago
by Kelikmalok
…palindrome."; } getch(); } bool checkIfPalindrome(char word[]) {
charStack
reverseWord; bool fail; reverseWord.top = strlen(word); for (… } else { return -1; //Error } return 0; //Success } char
charStack
::pop() { char deletedItem; if (!empty()) { deletedItem = array[top]; top--;…
Re: Palindrome using stacks
Programming
Software Development
14 Years Ago
by arkoenig
… problems are. However, the code that you posted for
charStack
::push ahd
charStack
::pop is broken. To see this, try creating a…
charStack
object, pushing a few characters onto it, and then popping …
Re: I created another Stack that tells if word is palindrome, need help
Programming
Software Development
19 Years Ago
by visual one
I'm getting an <identifier> expected error. on this line here: private Stack<Character>
charStack
= new Stack<Character>();
Re: I created another Stack that tells if word is palindrome, need help
Programming
Software Development
19 Years Ago
by iamthwee
[QUOTE]private Stack[B]<[/B]Character[B]>[/B]
charStack
= new Stack<Character>();[/QUOTE] This is more of …
Help about the Stack infix operation
Programming
Software Development
13 Years Ago
by andy8521
…;math.h> #include "numStack.h" #include"
charStack
.h" using namespace std; int getNum(int num[],int… = NULL; int popResult = 0; int j=0; numStack intStack(stackSize);
charStack
opStack(stackSize); for(int i=0;i<stackSize;i…
Re: Prefix to Postfix conversion
Programming
Software Development
10 Years Ago
by Ian_7
… java file: public class CharStackPrac { private char[]
charStack
; private int top; private int maxSize; public CharStackPrac…(int size) { maxSize = size;
charStack
= new char[maxSize]; top = -1; // no char …
Re: Stack- need help
Programming
Software Development
19 Years Ago
by visual one
<identifier> expected. this is what I have written: private Stack<Character>
charStack
= new Stack<Character>();
Re: Problem with interfaces
Programming
Software Development
13 Years Ago
by vishal1949
… or 25000 pounds. I am going to have to use
charstack
(); push(); and pop(); for that. Could someone tell me whether…
Re: Expert advice on DIY stacks please...
Programming
Software Development
13 Years Ago
by Narue
[QUOTE]now that I added more options it's not working and now I'm lost, any expert advice or tips from a second pair of eyes?[/QUOTE] My advice is roll back to something that works and add new options more carefully. For example, add debugging output such as the contents of the stack and the values you're testing at each step.
1
2
3
Next
Search
Search
Forums
Forum Index
Hardware/Software
Recommended Topics
Programming
Recommended Topics
Digital Media
Recommended Topics
Community Center
Recommended Topics
Latest Content
Newest Topics
Latest Topics
Latest Posts
Latest Comments
Top Tags
Topics Feed
Social
Top Members
Meet People
Community Functions
DaniWeb Premium
Newsletter Archive
Markdown Syntax
Community Rules
Developer APIs
Connect API
Forum API Docs
Tools
SEO Backlink Checker
Legal
Terms of Service
Privacy Policy
FAQ
About Us
Advertise
Contact Us
© 2025 DaniWeb® LLC