View Code of Problem 9

#include<iostream>
#include<string>
using namespace std;
int main() {
	int n, k = 1,score;
	bool flag;
	while (cin >> n) {
		int rem_n = n;
		score = 0, flag = false;
		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 = true;}
			else if (str1 == "Lazy")      score += 15;
			else  score += 20;
		}
		if (rem_n >= 10 && flag == true) score += 50;
		cout << "Case #" << k << ": " << score << endl;
		k++;
	}
}

Double click to view unformatted code.


Back to problem 9