View Code of Problem 9

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
int main() {
	int n;
	int k=1;
	while(scanf("%d",&n)!=EOF){
		int i=0;
		int sum=0;
		int flag=0;
		int x=n;
		char a[100];
		char b[100];
		while(n--){
			scanf("%s%s",a,b);
			if(strcmp(b,"goat")!=0){
				break;
			}
			if(strcmp(a,"Pleasant")==0){
				sum=sum+5;
			}
			else if(strcmp(a,"Pretty")==0){
				sum=sum+8;
			}
			else if(strcmp(a,"Athletic")==0){
				sum=sum+10;
				flag=1;
			}
			else if(strcmp(a,"Lazy")==0){
				sum=sum+15;
			}
			else if(strcmp(a,"Slow")==0){
				sum=sum+20;
			}
			
		}
		if(x>=10&&flag==1){
			sum=sum+50;
		}
		printf("Case #%d: %d",k,sum);
		k++;
		
	}
	
	
	
	
}

Double click to view unformatted code.


Back to problem 9