写出下列程序段的输出结果。(假设此栈中元素的类型是char)
voide main()
{stack s;
char x,y;
InitStack(s)
x=‘1’,y=‘0’
push(s,x);
push(s,x);
push(s,y);
push(s,x);
push(s,‘e’);
push(s,x);
pop(s,x);
push(s,‘h’);
while(!stackEmpty(s))
{pop(s,y);
printf(y);
}
prinft(x)
}
第3题
写出下列程序段的输出结果(栈的元素类型SElemType为char)。
void main()
{
Stack S;
char x,y;
lnitStack(S);
x='c';
y='k';
Push(S,x);
Push(S,'a');
Push(S,y);
Pop(S,x);
Push(S,'t');
Push(S,x);
Pop(S,x);
Push(S,'s');
While(!StackEmpty(S))
{
Pop(S,y);
printf(y);
}
printf(x);
}
第6题
第7题
写出以下程序段的输出结果(队列中的元素类型QElemType为char)。 void main() { Queue Q; InitQueue(Q); char x= ‘e’, y= ‘c’; EnQueue(Q, ‘h’); EnQueue(Q, ‘r’); EnQueue(Q, y); DeQueue(Q, x); EnQueue(Q, x); DeQueue(Q, x); EnQueue(Q, ‘a’); While(!QueueEmpty(Q)) { DeQueue(Q,y); cout<<y; }>
为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!