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

哪位大牛指教,不知为何老RUNTIME ERROR?

Posted by 1030690116 at 2011-03-31 20:41:28 on Problem 1028
#include<iostream>
#include<string>
using namespace std;
struct st
{
     string a[101];
     int t;
}st1,st2;

int main()
{
    string b[4]={"VISIT","FORWARD","BACK","QUIT"};
    string m;
    st1.t=1,st2.t=0;
    st1.a[st1.t]="http://www.acm.org/";
    while(cin>>m)
    {
        int i,flag=0;
        for(i=0;i<4;i++)
        {
            if(m==b[i]) break;
        }
        switch(i)
        {
            case 0: {cin>>st1.a[++st1.t];cout<<st1.a[st1.t]<<endl;st2.t=0;break;}
            case 1: {if(st2.t>=1) {cout<<st2.a[st2.t]<<endl;st1.a[++st1.t]=st2.a[st2.t--];}
                        else cout<<"Ignored"<<endl;
                        break;}
            case 2: {if(st1.t>=2)  {cout<<st1.a[st1.t-1]<<endl;st2.a[++st2.t]=st1.a[st1.t--];} 
                        else  cout<<"Ignored"<<endl;
                        break;}
            case 3:  {flag=1;break;}
        }
        if(flag) break;
    }
    system("pause");
    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