Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

我的程序输出结果和题目一样,错在哪??

Posted by dexter at 2004-02-26 13:16:22 on Problem 1028
#include<stdio.h>
#include<string.h>
char str[100][70];
static char cmd[7];//command
static char url[70];//web page
main()
{
	int i,j;
	char cur[70];//current page
	i=-1;//-1 表示back栈空,100表示forward栈空
	j=100;
	strcpy(cur,"http://www.acm.org");
	scanf("%s",cmd);
	while(strcmp("QUIT",cmd))
	{
		if(!strcmp(cmd,"VISIT"))
		{
			scanf("%s",url);
			i++;
			strcpy(str[i],cur);
			strcpy(cur,url);
			puts(cur);
			j=100;
		}
		if(!strcmp(cmd,"BACK"))
		{
			if(i!=-1)
			{
			j--;
			strcpy(str[j],cur);
			strcpy(cur,str[i]);
			i--;
			puts(cur);
			}
			else
				puts("Ignored");
		}
		if(!strcmp(cmd,"FORWARD"))
		{
			if(j!=100)
			{
				i++;
				strcpy(str[i],cur);
				strcpy(cur,str[j]);
				j++;
				puts(cur);
			}
			else
				puts("Ignored");
		}
		scanf("%s",cmd);
	}
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator