📄 pku1028.cpp
字号:
#include <stdio.h>
#include <string.h>
char name[1000][80];
int f[1000], b[1000];
int ftop, btop, vid, cur;
void out(int x)
{
printf("%s\n", name[x]);
}
void init()
{
vid = 1;
cur = 0;
strcpy(name[0], "http://www.acm.org/");
btop = 0;
ftop = 0;
}
void Visit()
{
scanf("%s", name[vid]);
ftop = 0;
b[++btop] = cur;
cur = vid;
out(cur);
vid++;
}
void Back()
{
if (btop <= 0)
{
printf("Ignored\n");
return;
}
f[++ftop] = cur;
cur = b[btop];
out(cur);
btop--;
}
void Forward()
{
if (ftop <= 0)
{
printf("Ignored\n");
return;
}
b[++btop] = cur;
cur = f[ftop];
out(cur);
ftop--;
}
int main()
{
char s[10];
int i = 0;
init();
while (1)
{
scanf("%s", s);
if (s[0] == 'V')
Visit();
else if (s[0] == 'B')
Back();
else if (s[0] == 'F')
Forward();
else
break;
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -