View Code of Problem 9

#include <iostream>
using namespace std;
int main(){
	int t=0,n;
	while(cin>>n){
		t++;
		cin>>n;
		string str;
		int goal = 0;
		for(int i=0;i<n;i++){
			getline(cin,str);
			bool feiyangyang = false;
			if(str == "Pleasant goat")
				goal += 5;
			else if(str == "Pretty goat")
				goal += 8;
			else if(str == "Athletic goat"){
				goal += 8;
				feiyangyang = true;
			}
			else if(str == "Lazy goat")
				goal += 8;
			else if(str == "Slow goat")
				goal += 8;
			if(n>=10&&feiyangyang){
				goal += 50;
			}				
		}
		cout<<"Case #"<<t<<": "<<goal;
	}
}

Double click to view unformatted code.


Back to problem 9