View Code of Problem 9

#include<stdio.h>
#include<string.h>
int main()
{
	char A[]="Pleasant";
	char B[]="Pretty";
	char C[]="Athletic"; 
	char D[]="Lazy";
	char E[]="Slow";
	
	int k=0;
	int i,score,flag;
	int n;
	char str[20],sq[10];
	while(scanf("%d",&n)!=EOF)
	{
		getchar();
		
		k++;
		score=0,flag=0;
		for(i=1;i<=n;i++)
		{
			scanf("%s%s",str,sq);
			if(strcmp(str,A)==0)
				score+=5;
			else if(strcmp(str,B)==0)
				score+=8;
			else if(strcmp(str,C)==0)
			{
				score+=10;
				flag=1;
			}
			else if(strcmp(str,D)==0)
				score+=15;
			else if(strcmp(str,E)==0)
				score+=20;			
		}
		if(n>=10&&flag==1)
			score+=50;
		printf("Case #%d: %d\n",k,score);
	}
	
	
	return 0;
}

Double click to view unformatted code.


Back to problem 9