View Code of Problem 9

#include<bits/stdc++.h>
using namespace std;
int main(){
	int t=0,n,i,c,x;
	while(cin>>n){
		t++;
		string s;
		c=0;
		x=0;
		for(i=0;i<=n;i++){
			getline(cin,s);
			if(s=="Pleasant goat")
				c+=5;
			else if(s=="Pretty goat")
				c+=8;
			else if(s=="Athletic goat"){
				c+=10;
				x=1;
			}
			else if(s=="Lazy goat")
				c+=15;
			else if(s=="Slow goat")
				c+=20;
		}
		if(x==1&&n>=10){
			c+=50;
		}
		cout<<"Case #"<<t<<":"<<c<<endl;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 9