int main() { printf("栈的元素个数:"); int n; cin >> n; SqStack S; InitStack(S); for (int i = 0; i < n; i++) { int temp; cin >> temp; Push(S, temp); } printf("栈顶的值为:"); int k; printf("%d\n", GetTop(S, k)); print(S); int del; int t = Pop(S, del); if (t) printf("删除栈顶值%d成功\n",t); printf("剩余的值为:"); print(S); printf("继续插入一个值:"); int extra; cin >> extra; Push(S,extra); cout << endl; print(S); return 0;
}
|