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 |
哪位高手帮我看看,到底是哪出了问题,交的时候总是WA。Why????#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator