POJ 1028
来源:互联网 发布:赴港产子知乎 编辑:程序博客网 时间:2024/05/20 14:19
模拟网页,大水。
<pre name="code" class="cpp">#include<iostream>#include<cstdio>#include<cstring>using namespace std;#define max 105char arr[max][max];void initarr(){ for(int i=0; i<max; i++) //memset(arr[i],"\0",max); strcpy(arr[i],"\0");}int main(){ int i,j,k,m,n,t; char input[max]="\0"; int top=-1; int base=-1; initarr(); strcpy(arr[0],"http://www.acm.org/"); base++; top++; while(gets(input)) { if(!strcmp(input,"QUIT")) { return 0; } char order[max]="\0"; // memccpy(order,input,' ',strlen(input)); for(i=0; i<strlen(input); i++) { if(input[i]!=' ') order[i]=input[i]; else break; } if(!strcmp(order,"BACK")) { if(top<=0) cout<<"Ignored"<<endl; else { top--; cout<<arr[top]<<endl; } } else if(!strcmp(order,"FORWARD")) { if(top>=base) cout<<"Ignored"<<endl; else { top++; //base++; cout<<arr[top]<<endl; } } else { char url[max]="\0"; for(i=strlen(order)+1; i<strlen(input); i++) url[strlen(url)]=input[i]; top++; strcpy(arr[top],url); for(i=top+1; i<base; i++) { strcpy(arr[i],"\0"); } base=top; cout<<arr[top]<<endl; } } return 0;}
0 0
- poj-1028
- POJ 1028
- POJ 1028
- POJ-1028
- POJ 1028
- POJ 1028
- POJ 1028
- POJ 1028
- poj 1028
- poj 1028
- POJ 1028 Web Navigation
- POJ 1028 字符串
- POJ 1028 Web Navigation
- poj 1028 Web Navigation
- Web Navigation poj 1028
- poj 1028 Web Navigation
- POJ-1028-Web Navigation
- poj 1028 Web Navigation
- hadoop的编程实例
- Linux(CentOS)SSH无密码验证登陆
- 关于druid数据连接池抛出的 connection holder is null 异常
- C学习笔记(十一)C预处理器和C库
- C++常见错误总结(不定时更新版~)
- POJ 1028
- Adobe Flash Player ActiveX 不能安装的解决方法
- 实现一个通讯录并将信息保存到文本中
- 关于粒子平流与FTLE场计算的代码说明注释
- JQuery上传插件Uploadify使用详解
- Training:母函数
- myeclipse如何显示行数
- 在Fedora 18中将普通用户设置为sudo权限
- 程序的运行