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> #define MAX 100 char nowadd[50]; typedef struct { char cw[MAX][50]; int top; }cug; void push(cug *h) { h->top+=1; strcpy(h->cw[h->top],nowadd); } void pop(cug *v) { if(v->top>=0) { strcpy(nowadd,v->cw[v->top]); v->top-=1;} } int judge(cug *r) { if(r->top<0) return 0; return 1; } void main() { int i; char oradd[50],ord[10]; cug bs,fs; bs.top=-1; fs.top=-1; strcpy(nowadd,"http://www.acm.org/"); scanf("%s",ord); while(strcmp(ord,"QUIT")&&(!strcmp(ord,"BACK")||!strcmp(ord,"VISIT")||!strcmp(ord,"FORWARD"))) { if(!strcmp(ord,"BACK")) { i=judge(&bs); if(i) { push(&fs); pop(&bs); puts(nowadd); } else printf("Ignored\n"); } if(!strcmp(ord,"VISIT")) { push(&bs); fs.top=-1; scanf("%s",oradd); strcpy(nowadd,oradd); puts(nowadd); } if(!strcmp(ord,"FORWARD")) { i=judge(&fs); if(i) { push(&bs); pop(&fs); puts(nowadd); } else printf("Ignored\n"); } scanf("%s",ord); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator