|
Quiz, Lecture 19 |
Show the result of executing the following stack code.
Stack s; int v1,v2,v3,v4,v5,v6; s.push(1); s.push(2); v1 = s.pop(); s.push(3); s.push(4); v2 = s.pop(); s.push(5); v3 = s.pop(); v4 = s.pop(); v5 = s.pop(); v6 = s.pop();
#2: Show changes to stack after following code.
Stack s;
int i;
s.push(5);
s.push(3);
s.push(9);
i = s.pop();
i = s.top();
s.push(6);
s.push(4);