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 |
帮忙看看,哪出现了逻辑问题,C语言用的不熟# include <stdio.h> # include <malloc.h> # include <string.h> main() {int x,y=0,o=0,i,k,p[11];char s0[8],s1[]={"high"},s2[]={"low"},s3[]={"on"},s[6]; typedef struct node{ int data; struct node *link; } JD; JD *h,*r,*v;h=(struct node *)malloc(sizeof(struct node));h->link=NULL;v=h; scanf("%d",&x);scanf("%s %s",s,s0); while (o==0) {while (strcmp(s0,s3)!=0) {p[x]=1;if (strcmp(s0,s1)==0) {for (k=x;k<=10;k++) {p[k]=1;}} if (strcmp(s0,s2)==0) {for (k=x;k>0;k--) {p[k]=1;}} scanf("%d",&x);scanf("%s %s",s,s0);} if (strcmp(s0,s3)==0) {for (i=1;i<=10;i++){if(p[i]==0) y+=1;} r=(struct node*)malloc(sizeof(struct node));r->data=y;h->link=r;r->link=NULL;h=h->link; scanf("%d",&x);if (x==0) break;scanf("%s %s",s,s0);} for (i=1;i<=10;i++) {p[i]=0;}if (x==0) break; } v=v->link; for(;v->link!=NULL;) {if (v->data==0) printf("Stan is dishonest\n"); if (v->data!=0) printf("Stan may be honest\n");v=v->link; } if (v->data==0) printf("Stan is dishonest\n"); if (v->data!=0) printf("Stan may be honest\n"); } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator