View Code of Problem 9

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

Double click to view unformatted code.


Back to problem 9