View Code of Problem 9

#include<iostream>
#include<string>
using namespace std;

int main(){
	int n;
	int k=1;
	while(scanf("%d",&n)!=EOF){
		string type;
		string goat; 
		int grade=0;
		bool getAthletic = false;
		for(int i=0;i<n;++i){
			cin>>type>>goat;
			if(type=="Pleasant"){
				grade+=5;
			}
			else if(type=="Pretty"){
				grade+=8;
			}
			else if(type=="Athletic"){
				grade+=10;
				getAthletic=true;
			}
			else if(type=="Lazy"){
				grade+=15;
			}
			else if(type=="Slow"){
				grade+=20;
			}
		}
		if(getAthletic && n>=10){
			grade+=50;
		}
		printf("Case #%d: %d\n",k++,grade);
	}
}

Double click to view unformatted code.


Back to problem 9