讨论 / 郁闷,只是将数组开大一些20分变成AC。。。
nw4869 2013-07-15 09:47:00
点我顶贴 收藏 删除
#include <stdio.h>

#include <string.h>

int main()

{

char command[100];

char URL[500][200];

int tot=1;

int point=1;

strcpy(URL[1],"http://www.acm.org/");

do{

scanf("%s",command);

if (strcmp(command,"VISIT")==0)

{

scanf("%s",URL[++point]);

tot=point;

printf("%s\n",URL[tot]);

}

if (strcmp(command,"BACK")==0)

if (point > 1)

printf("%s\n",URL[--point]);

else printf("Ignored\n");

if (strcmp(command,"FORWARD") == 0)

if (point < tot)

printf("%s\n",URL[++point]);

else printf("Ignored\n");

}while (strcmp(command,"QUIT"));

return 0;

}

查看更多回复
提交回复