View Code of Problem 9

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main() {
	int n;
	int count=1;
	while(scanf("%d",&n)!=EOF){
		
		int r=n;
	int sum=0;
	char a[1000],b[1000];
	int flag=0;
	while(n--){
		scanf("%s%s",&a,&b);
		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(r>=10 && flag==1){
		sum=sum+50;
	}
	printf("Case #%d: %d\n",count,sum);
	count++;
	}
}

Double click to view unformatted code.


Back to problem 9