View Code of Problem 9

#include<iostream>
#include<string>
#include<cstring>
using namespace std;
int main(){
	int n, k=1;
	while(cin>>n){
		getchar();
		
			int score = 0,flag=0;
			string s[10000]={};
		
			for(int i=0;i<n;i++){
				getline(cin,s[i]);
				if(s[i]=="Pleasant goat"){
					score+=5;
				}
				else if(s[i]=="Pretty goat"){
					score+=8;
				
				}
				else if(s[i]=="Athletic goat"){
					score+=10;
					flag=1;
				}
				else if(s[i]=="Lazy goat"){
					score+=15;
				}
				else if(s[i]=="Slow goat"){
					score+=20;
				}
//				cout<<i<<" "<<score<<endl;
				
			}
			if(flag==1&&n>=10){
					score+=50;
				}
						
		
		cout<<"Case #"<<k++<<": "<<score<<endl;
		
	}
	
	return 0;
}

Double click to view unformatted code.


Back to problem 9