Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
哪位大牛指教,不知为何老RUNTIME ERROR?#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator