int main() { int x; LinkedStack<int> L; L.Add(2).Add(1).Add(8); cout << " Top element is " << L.Top() << endl; L.Delete(x); cout << " Element deleted is " << x << endl; cout << " Top element is " << L.Top() << endl; system("pause"); return 0; }
bool CheckBox(int p[],int n) { LinkedStack<int> s; int c; for(int i=0;i<n;i++) { if(!s.IsEmpty()) { if(s.Top()==p[i]) s.Delete(c); else s.Add(p[i]); } else { s.Add(p[i]); } } if(s.IsEmpty()) return true; else return false; }