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 |
why wrong?#include<iostream> #include<string> using namespace std; char w[210][80]; int co,i; char na[100],*p; void BACK(); void FORWARD(); void VISIT(); int main() { strcpy(w[0],"http://www.acm.org/"); co=i=0; while(cin.getline(na,100)) { if(strcmp(na,"QUIT")==0)break; if(na[0]=='B')BACK(); if(na[0]=='F')FORWARD(); if(na[0]=='V')VISIT(); } return 0; } void BACK() { if(i==0) { cout<<"Ignored\n"; return; } i--; cout<<w[i]<<endl; } void FORWARD() { if(i==co) { cout<<"Ignored\n"; return; } i++; cout<<w[i]<<endl; } void VISIT() { if(i==co)co++; i++; p=&na[6]; strcpy(w[i],p); cout<<w[i]<<endl; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator