View Code of Problem 9

#include<iostream>
#include<string>
#include<stdio.h>
using namespace std;
int main(){
	int n;


	
	string xyy="Pleasant goat";
	string meiyy="Pretty goat";
	string fyy="Athletic goat";
	string lyy="Lazy goat";
	string manyy="Slow goat";
	string goat[1000];
	int k=1;
	int point;
	int isF;
	while(scanf("%d",&n)){
		point=0;
		isF=0;
		
		for(int i=0;i<=n;i++){
			getline(cin,goat[i]);
		}
		
			for(int i=0;i<=n;i++){
				if(goat[i]==xyy){
					point=point+5;
				}
				else if(goat[i]==meiyy){
					point=point+8;
				}
				else if(goat[i]==fyy){
					point=point+10;
					isF=1;
				}
				else if(goat[i]==lyy){
					point=point+15;
				}
				else if(goat[i]==manyy){
					point=point+20;
				}	
			}

		if(isF==1&&n>=10){
			point=point+50;
		}	
		cout<<"Case #"<<k<<": "<<point<<'\n';
		k++;
	}

}

Double click to view unformatted code.


Back to problem 9