View Code of Problem 9

#include <iostream>
#include<cstdio>
#include<algorithm>
#include<cstdbool>
#include<cmath>
#include<string>
#include<cstring>

using namespace std;





int main()
{
	string pp;
	int n;
	int d[1100] = {};
	int y;
	int g = 1;
	while(cin >> y){
		string shou;
		string goat;
	int sum=0;

	int flag = 0;

	for (int i = 0; i < y; i++) {
		cin >> shou >> goat;
		pp = shou + ' ' + goat;
			if (pp == "Pleasant goat") {
				sum = sum + 5;
			}
			else if (pp == "Pretty goat") {
				sum = sum + 8;
			}
			else if (pp == "Athletic goat") {
				sum = sum + 10;
				flag = 1;
			}
			else if (pp == "Lazy goat") {
				sum = sum + 15;
			}
			else if(pp=="Slow goat"){
				sum = sum + 20;
			}
		}
		if (y >= 10 && flag == 1) {
			sum = sum + 50;
		}
		
		printf("Case #%d: %d\n", g,sum);
		g++;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 9