View Code of Problem 9

#include<iostream>
#include<string>
using namespace std;
int main() {
	int n, k = 1;
	int score, flag;
	while (cin >> n) {
		int keep_n = n;
		score = 0, flag = 0;
		while (n--) {
			string str1,goat;
			cin >>str1>>goat;
			if (str1 == "Pleasant") 
				score += 5;
			else if (str1 == "Pretty") 
				score += 8;
			else if (str1 == "Athletic") {
				score += 10;
				flag = 1;
			}
			else if (str1 == "Lazy") 
				score += 15;
			else 
				score += 20;
		}
		if (keep_n >= 10 && flag == 1)
			score += 50;
		cout << "Case #" << k << ": " << score << endl;
		k++;
	}
}

Double click to view unformatted code.


Back to problem 9