poj1028
来源:互联网 发布:vscode在插件 编辑:程序博客网 时间:2024/05/22 04:31
1、初始化双向链表,头对应首页
2、得到每行第一个字母
{
1、V,得到本行空格以后的内容,接到当前指针后面
2、B,当前指针向前
3、F,当前指针向后
4、Q,退出
若越界,输出Ignored。不执行指针替换
}
2、得到每行第一个字母
{
1、V,得到本行空格以后的内容,接到当前指针后面
2、B,当前指针向前
3、F,当前指针向后
4、Q,退出
若越界,输出Ignored。不执行指针替换
}
需要注意的问题:无用字符怎么略过
#include <stdio.h>#include <stdlib.h>#include <string.h>typedef struct node {struct node *forward;char ur[73];struct node *next;}*url;url head;url now;//当前指针void judge(char o){if (o=='B'){if (now->forward==NULL){printf("Ignored\n");}else {now=now->forward;printf("%s\n",now->ur);}while(getchar()!='\n');}else if(o=='F'){if(now->next==NULL)printf("Ignored\n");else {now=now->next;printf("%s\n",now->ur);}while(getchar()!='\n');}else if(o=='V'){while(getchar()!=' ');url p;p=(url)malloc(sizeof(struct node));p->next=NULL;p->forward=now;now->next=p;now=p;gets(now->ur);//getchar();printf("%s\n",now->ur);}}int main(){char tmp;//url head;head=(url)malloc(sizeof(struct node));head->forward=NULL;head->next=NULL;strcpy(head->ur,"http://www.acm.org/");//url now;now=(url)malloc(sizeof(struct node));now=head;scanf("%c",&tmp);while(tmp!='Q'){judge(tmp);//while(getchar()!='\n');scanf("%c",&tmp);}return 0;}
- POJ1028
- POJ1028
- poj1028
- poj1028
- POJ1028
- poj1028
- poj1028 栈
- poj1028 模拟
- poj1028 Web Navigation
- POJ1028解题报告
- poj1028--Web Navigation
- poj1028【STL stack】
- <poj1028> Web Navigation
- POJ1028 Web Navigation
- POJ1028 STL_STACK应用
- poj1028-Web Navigation(水题)
- 【poj1028】Web Navigation
- poj1028 Web Navigation
- SQL Server数据类型的介绍
- How to make android app's background image repeat
- ubuntu安装使用tftp
- 排错:libstdc++.a: No such file: Permission denied
- asp.net数据绑定
- poj1028
- java abstract
- Page_load事件
- 遇到Word2007 只能打开一个文档,切换窗口再回去鼠标也不能用。解决问题
- eclipse编译调试java与ndk c++的混合代码
- 2011-11-21 —— wince6.0 BSP 里面加了 locale 后编译 failed 之解决办法
- 【.net】在DataList截取字符串
- 上传文件
- php数据库连接