poj 1028 Web Navigation
来源:互联网 发布:人员优化 编辑:程序博客网 时间:2024/05/17 05:57
链接:点击打开链接
对栈的运用。
#include<iostream> #include<stack> #include<string> #include<cstdio> #include<cstring> using namespace std; int main(){ stack<string>forward,backward; int i,j; string s,current="http://www.acm.org/"; while(getline(cin,s)){ if(s=="QUIT") break; if(s.size()>7){ backward.push(current); current=s.substr(6); cout<<current<<endl; while(!forward.empty()) forward.pop(); } else if(s=="BACK"){ if(backward.empty()) cout<<"Ignored"<<endl; else{ forward.push(current); current=backward.top(); backward.pop(); cout<<current<<endl; } } else if(s=="FORWARD"){ if(forward.empty()) cout<<"Ignored"<<endl; else{ backward.push(current); current=forward.top(); forward.pop(); cout<<current<<endl; } } } return 0; }
- POJ 1028 Web Navigation
- POJ 1028 Web Navigation
- poj 1028 Web Navigation
- Web Navigation poj 1028
- poj 1028 Web Navigation
- POJ-1028-Web Navigation
- poj 1028 Web Navigation
- poj-1028 Web Navigation
- POJ 1028 Web Navigation
- poj 1028 Web Navigation
- POJ 1028 Web Navigation
- POJ 1028 - Web Navigation
- POJ 1028 Web Navigation
- poj 1028 Web Navigation
- POJ 1028 Web Navigation
- POJ 1028 - Web Navigation
- POJ 1028----Web Navigation
- poj 1028-Web Navigation
- rqnoj-57-找啊找啊找GF
- LoadRunner字符集与检查点的探讨
- UNIX网络编程——TCP带外数据小结
- 行车路程
- 设计模式学习------策略模式
- poj 1028 Web Navigation
- ZOJ3712:Hard to Play
- POJ3624 Charm Bracelet
- 大端模式和小端模式
- PieVectTable dsp ti 中断向量表
- java排序算法
- .Net 网页几秒后跳转页面的实现
- 日志分析
- 最大连续子序列和