View Code of Problem 9

#include<stdio.h>
#include<string.h>
int main(){
	int n,i=0,j,point=0,athsheep=0;
	char sheep[30];
	char goat[10];
	while(scanf("%d",&n)!=EOF){
		i++;
		point=0;
		for(j=0;j<n;j++){
			scanf("%s%s",sheep,goat);
			if(strcmp(sheep,"Pleasant")==0){
				point+=5;
			}
			else if(strcmp(sheep,"Pretty")==0){
				point+=8;
			}
			else if(strcmp(sheep,"Athletic")==0){
				point+=10;
				athsheep=1;
			}
			else if(strcmp(sheep,"Lazy")==0){
				point+=15;
			}
			else if(strcmp(sheep,"Slow")==0){
				point+=20;
			}
		}
		if(n>=10&&athsheep==1){
			point+=50;
		}
		printf("Case #%d: %d\n",i,point);
	}
	return 0;
} 

Double click to view unformatted code.


Back to problem 9