poj_1028 Web Navigation
来源:互联网 发布:ora27102 windows 编辑:程序博客网 时间:2024/05/17 07:29
#include <stdio.h>#include <stdlib.h>#include <string.h>#define C_MAX 70struct weburl{char url[C_MAX];struct weburl *next;struct weburl *prev;};void web_navigation(){char temp[70];struct weburl *head = (struct weburl *)malloc(sizeof(struct weburl));struct weburl *p2 = head;struct weburl *p1 =NULL; struct weburl *tp =NULL;struct weburl *newurl =NULL;strcpy(head->url,"http://www.acm.org/");head->next = NULL;head->prev = NULL;while(scanf("%s",temp)!=EOF){if(strcmp(temp,"BACK") == 0){if(p2->prev != NULL) {p2 = p2->prev;printf("%s\n",p2->url); }else{printf("Ignored\n");} } else if(strcmp(temp,"FORWARD") == 0){if(p2->next != NULL) {p2 = p2->next;printf("%s\n",p2->url); }else{printf("Ignored\n");} }else if(strcmp(temp,"VISIT") == 0){newurl = (struct weburl*)malloc(sizeof(struct weburl));scanf("%s",newurl->url);newurl->next = NULL;newurl->prev = p2;p1 = p2->next;p2->next = newurl;p2 = newurl; tp =p1; while(tp != NULL) { p1 = p1->next; free(tp); tp=p1; } p1 =NULL;printf("%s\n",newurl->url);}else if(strcmp(temp,"QUIT") == 0){ goto exit;}memset(temp,0,sizeof(temp)/sizeof(temp[0]));}exit: tp = head; while(tp != NULL) { head = head->next; free(tp); tp = head; } tp =NULL; p2 =NULL; newurl =NULL; head = NULL;}int main(void){ web_navigation();}
0 0
- poj_1028 Web Navigation
- POJ_1028
- poj_1028
- Web Navigation
- Web Navigation
- Web Navigation
- Web Navigation
- Web Navigation
- Web Navigation
- Web Navigation
- Web Navigation
- zoj1061 Web Navigation
- PKU 1028 Web Navigation
- ZOJ-1061-Web Navigation
- fjnu 1060 Web Navigation
- 1028 Web Navigation
- poj1028 Web Navigation
- ZOJ1061 Web Navigation
- html dl dt dd标签元素语法结构与使用
- excel宏:列出一个目录下所有文件,并做也超链接
- VLD调试介绍
- Jsp论坛系统(BBS)源码
- linux下彻底删除oracle
- poj_1028 Web Navigation
- Elasticsearch、MongoDB和Hadoop比较
- 本文出自大苞米的博客(http://blog.csdn.net/a396901990)
- 水平居中与垂直居中的区别
- springmvc、jpa、spring、mongodb和ehcache整合框架demo
- pojo与JavaBean的区别
- nginx 新手学习笔记
- 1044. Shopping in Mars (25)
- Vim 文件比较