Wow, I don't know what I was thinking.. I was making that a lot harder than it had to be.
Thanks a lot guys.
Daved - you are the man, thanks for the help.
Type: Posts; User: dld333
Wow, I don't know what I was thinking.. I was making that a lot harder than it had to be.
Thanks a lot guys.
Daved - you are the man, thanks for the help.
Sorry, I thought new post was correct action. Won't happen again.
So the only solution is going to involve pointers.....?
-Never knew, thats SWEET!
Hmmm.. Using those pointers in my pop() function, bit confused.
Current is the index of the top of the stack.
I need to Delete the value that is in the current location, then return that value, then decrement current.
Won't that just delete current -...
I need this function to return the value in the 'current' location, then decrement the current value.
My question is, how do I return, but then still decrement after that return in the same...
Daved, you around?
Crap.. Do you know of any way to accomplish this?
I thought this would work:
int Stack::pop()
{
if(current == 0)
return 0;
So I should change code around in the Stack Class pop() member function? Opposed to messing with the SearchableStack Class add() func.?
Thanks.
I was returning the next item in the stack..
Dont think this effects my issue - ?
Current is the number in which spot the top of the stack is.
So if the stack has: 333, 4, 44, 2
Current = 4
Also you may see the:
//SearchableStack.cpp
#include <iostream>
#include "SearchableStack.h"
; //i have no freaking clue...
using namespace std;
Ok, I updated the SearchableStack Class using the local value since its better practice.
Here is everything you should need - and thanks for helping!
Test #1 (finding something in the stack):...
I am having problems implementing a SearchableStack Class as a subclass of Stack class.
Here is the design:
List Class -->(composition)-->Stack Class-->(inheritance)-->SearchableStack Class
...
Is using vectors a more efficent way of allocating dynamic memory than a linked list?
And or something like..
int main(int argc, char *argv[])
{
ifstream inputFile;
string fileName;
char yesno;
Give the array a const size, then grow where needed.
What exactly do you mean "execute a DOS command" ?
Are you refering to accessing DOS features while in runtime?
So...
delete [] list;
list = temp;
Is that better?
Ok, I am clear with the delete - I forgot to use delete [], I must be drunk..
Also, I am using Length() - 1 because my length function is implenmented to return the "logical" size of the array.. IE: if there is one entry in the array, its in spot 0, so the Length() with do a...
No, end is the last entry in the array. So about deleting, I am alittle confused..
What you are saying is: the way I delete temp - leaves the memory allocated...?
So I need something to delete...
I am creating a list class using a dynamic array (later I will use a linked list). I am having trouble coming up with a good Add() function. Any help would be appreciated.
Private data members:...
It is to my understanding to overload the output operator (<<) you must declare the function as standalone - OK.
And also if you want to access the private data you need to make it a "friend" of...
Ohhh, so loc++, that does make scense. Thanks!