View Code of Problem 9

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

Double click to view unformatted code.


Back to problem 9