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 |
求解救,老是错的#include<stdio.h> #include<string.h> int main() { char y=0,n,x=0,str[101][101],str1[101][101],str2[101][101],z,j=0; strcpy(str[0],"VISIT"); strcpy(str[1],"http://www.acm.org/"); strcpy(str2[0],"http://www.acm.org/"); for(n=2;strcmp(str[n-1],"QUIT")!=0;n++) {scanf("%s",str[n]);} for(n=0;strcmp(str[n-1],"QUIT")!=0;n++) { if((strcmp(str[n],"QUIT")==0)||(strcmp(str[n],"VISIT")==0)||(strcmp(str[n],"BACK")==0)||(strcmp(str[n],"FORWARD")==0)) { strcpy(str1[x],str[n]); x++;}} x=0; for(n=1;strcmp(str[n-1],"QUIT")!=0;n++) {if((strcmp(str[n],"QUIT")!=0)&&(strcmp(str[n],"VISIT")!=0)&&(strcmp(str[n],"BACK")!=0)&&(strcmp(str[n],"FORWARD")!=0)) {strcpy(str2[x],str[n]); x++;}} x=0; for(z=0,n=0;strcmp(str1[n],"QUIT")!=0;z++,n++) { if(strcmp(str1[n],"VISIT")==0){ if(strcmp(str2[x],str[z+1])==0&&n>1) {x++;n++;z++;j=x-1;} else { z++;strcpy(str2[x+1],str[z]);j=x+1;} } if((strcmp(str1[n],"BACK")==0)) {x--;} if((strcmp(str1[n],"FORWARD")==0)||((strcmp(str1[n],"VISIT")==0)&&n>0)) {x++;} if(x<0) { printf("Ignored\n");x=0;} else if(x>j) { printf("Ignored\n");x=j;} else { if(n>0)printf("%s\n",str2[x]); }}} Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator