#include<stdio.h> #include<string.h> void main() { int n,i,k=1; while(scanf("%d",&n)!=EOF) { char a[n],b[n]; int flag=0,sum=0; for(i=0;i<n;i++) { scanf("%s %s",&a,&b); if(strcmp("Pleasant goat",a)==0) sum+=5; if(strcmp("Pretty goat",a)==0) sum+=8; if(strcmp("Athletic goat",a)==0) { flag=1;sum+=10; } if(strcmp("Lazy goat",a)==0) sum+=15; if(strcmp("Slow goat",a)==0) sum+=20; } if(n>=10&&flag==1) sum+=50; printf("Case #%d: %d\n",k++,sum); } /* Main.c:3:6: warning: return type of 'main' is not 'int' [-Wmain] void main() ^ Main.c: In function 'main': Main.c:12:4: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'char (*)[(sizetype)(n)]' [-Wformat=] scanf("%s %s",&a,&b); ^ Main.c:12:4: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'char (*)[(sizetype)(n)]' [-Wformat=] Main.c:29:2: error: expected declaration or statement at end of input } ^ */ |
Double click to view unformatted code.