public void UpdateStackDisplay() { textBox2.Text = ""; for (int i = 0; i < currentStack.GetCount(); i++) { textBox2.Text += "[" + (i + 1) + "] -> " + currentStack.GetElementOnNumber(i) + "\r\n"; } }
//Use my Stack class. public ListStack(Stack b) { listStack = new List<int>(); //Constructor for the List. stackPointer = 0; if (b != null) { int pointer2; int i = 0; int[] array = new int[10]; pointer2 = b.GetCount(); if (pointer2 > 0) { i = 1; } while (pointer2 > 0) { array[i] = b.Pop(); pointer2--; i++; } i--; while (i > 0) { this.Push(array[i]); i--; } } }
public ArrayStack(Stack b) { arrayStack = new int[10]; //Tis the the Array where the Values will be stored. Max 10 items. Pointer = 0; //A pointer to keep track of where to Pop or Push the next Value. if (b != null) { int pointer2; int i = 0; int[] array = new int[10]; pointer2 = b.GetCount(); if (pointer2 > 0) { i = 1; } while (pointer2 > 0) { array[i] = b.Pop(); pointer2--; i++; } i--; while (i > 0) { this.Push(array[i]); i--; } } }
public MyListStack(Stack b) { linkedListStack = new LinkedList <int>(); Pointer = 0; if (b != null) { int pointer2; int i = 0; int[] array = new int[10]; pointer2 = b.GetCount(); if (pointer2 > 0) { i = 1; } while (pointer2 > 0) { array[i] = b.Pop(); pointer2--; i++; } i--; while (i > 0) { this.Push(array[i]); i--; } } }
public MyListStack(Stack b) { linkedListStack = new LinkedList<int>(); Pointer = 0; if (b != null) { int pointer2; int i = 0; int[] array = new int[10]; pointer2 = b.GetCount(); if (pointer2 > 0) { i = 1; } while (pointer2 > 0) { array[i] = b.Pop(); pointer2--; i++; } i--; while (i > 0) { this.Push(array[i]); i--; } } }
public ListStack(Stack b) //Use my Stack class. { listStack = new List <int>(); //Constructor for the List. stackPointer = 0; if (b != null) { int pointer2; int i = 0; int[] array = new int[10]; pointer2 = b.GetCount(); if (pointer2 > 0) { i = 1; } while (pointer2 > 0) { array[i] = b.Pop(); pointer2--; i++; } i--; while (i > 0) { this.Push(array[i]); i--; } } }
public void EmptyStack(Stack stack) { //To clear the stack just Pop every item in the stack. int max = stack.GetCount(); for (int i = 0;i < max; i++){ stack.Pop(); } }
public void EmptyStack(Stack stack) { //To clear the stack just Pop every item in the stack. int max = stack.GetCount(); for (int i = 0; i < max; i++) { stack.Pop(); } }