I think i have the push working .... at least no errors when I run it, but I am lost with the pop .... & in the program how do you 'push' & 'pop' the number to the stack????????
[MOD EDIT: Disabled Smilies]Code:bool stacklist::push() { //ptrs = number(top), stacklist(head), push(nptr) bool success; number* nptr = new number; nptr->remainder = rem; if (head != NULL) { success = false; } else { if (head == NULL) { nptr->top = NULL; head = nptr; } else { nptr->top = head; head = nptr; } count++; } success = true; } bool stacklist::pop() { bool success; number* dlptr = new number; if (head != NULL) { success = false; } else { if (head == NULL) { cout << "Nothing to pop" << endl; } else { dlptr = top; } }



LinkBack URL
About LinkBacks


