View Code of Problem 9

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, cal = 1;
    while (scanf("%d", &n) != EOF)
    {
        int sum = 0;
        string s;
        getchar();
        for (int i = 0; i < n; i++)
        {
            getline(cin, s);
            s = s.substr(0, s.length() - 5);
            if (n >= 10 && s == "Athletic")
                sum += 50;
            if (s == "Pleasant")
                sum += 5;
            if (s == "Pretty")
                sum += 8;
            if (s == "Athletic")
                sum += 10;
            if (s == "Lazy")
                sum += 15;
            if (s == "Slow")
                sum += 20;
        }
        cout << "Case #" << cal++ << ":"
             << " " << sum << endl;
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 9