| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:可以用二维数组做,代码少点!In Reply To:Re:双向链表就可以轻松实现,这题就是纯链表操作 Posted by:huangchang9001 at 2011-03-25 21:29:17 #include<stdio.h>
#include<string.h>
char w[101][71];
char s[10];
int c;
int ftop;
void main()
{
c=0;
ftop=0;
strcpy(w[0],"http://www.acm.org/");
while(scanf("%s",s)!=EOF&&strcmp(s,"QUIT")!=0)
{
if(strcmp(s,"VISIT")==0)
{
c++;
scanf("%s",w[c]);
printf("%s\n",w[c]);
ftop=c;
}
else if(strcmp(s,"BACK")==0)
{
if(c>0)
{
c--;
printf("%s\n",w[c]);
}
else
printf("Ignored\n");
}
else if(strcmp(s,"FORWARD")==0)
{
if(c<ftop)
{
c++;
printf("%s\n",w[c]);
}
else
printf("Ignored\n");
}
else
{
printf("wrong\n");
}
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator