POJ 1028 字符串

来源:互联网 发布:淘宝网上买药可靠吗 编辑:程序博客网 时间:2024/05/29 04:01

题意:

浏览网页,这里有几种操作:

BACK: Push the current page on the top of the forward stack. Pop the page from the top of the backward stack, making it the new current page. If the backward stack is empty, the command is ignored. 
FORWARD: Push the current page on the top of the backward stack. Pop the page from the top of the forward stack, making it the new current page. If the forward stack is empty, the command is ignored. 
VISIT : Push the current page on the top of the backward stack, and make the URL specified the new current page. The forward stack is emptied. 
QUIT: Quit the browser. 

思路:模拟.设置一个字符串数组,用一个指针指向当前指向的网页,根据操作移动,唯一注意的是:执行VISIT时,前面的网页清空.

代码:

 

原创粉丝点击