Description
Please complete the previous question first!
NOTE that typo was
made by teacher
Buttom was spelled
instead of bottom
請先完成上一題!
Please write the following two functions:
請撰寫以下兩個函式:
int StackTop(Stack* obj): Return the value of the top node of the Stack.
int StackTop(Stack* obj):請回傳Stack最上方節點的值。
int StackBottom(Stack* obj): Return the value of the bottom node of the Stack.
int StackButtom(Stack* obj):請回傳Stack最底下節點的值。
Input
Input consists of multiple lines until EOF, each line contains the command (and required parameters).
輸入包含多行,直到EOF為止,每行包含要做的指令(以及需要的參數)。
For example: push 10, pop, printTop, printButtom.
例如:push 10, pop, printTop, printButtom。
Output
Refer to Description.
請參考 Description。
Sample Input 1
push 1
push -7
pop
push 1
push 22
printTop
pop
printButtom
printTop
push 7
push 45
push 17
printTop
push -10
printButtom
pop
pop
printTop
Sample Output 1
22
1
1
17
1
45