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

哪位高手帮我看看,到底是哪出了问题,交的时候总是WA。Why????

Posted by 200711010136 at 2008-08-01 14:10:15 on Problem 1028
#include <iostream>

using namespace std;

char arr[110][110];
char str[110];
int g=1,sum=1;
void visit()
{
         scanf("%s",arr[g]);
         puts(arr[g]);
         g++;
         sum=g;
}
void backstack()
{
        if(g-1==0)
        {
              printf("Ignored\n");
              return;
        }
        else{
              g--;
              puts(arr[g-1]);
        }

}
void forwardstack()
{
       if(g>=sum)
       {
              printf("Ignored\n");
              return ;
       }
       else{
                 puts(arr[g]);
                 g++;
       }
}
int main()
{
         while(1)
         {
                    scanf("%s",str);
                    if(str[0]=='Q')
                    break;
                    char arry[]="http://wwww.acm.org/";
                    strcpy(arr[0],arry);
                    switch(str[0])
                    {
                            case 'V':visit();
                                      break;
                            case 'B':backstack();
                                      break;
                            case 'F':forwardstack();
                                     break;
                    }
         }
         return 0;
}

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