View Code of Problem 9

#include <stdio.h>


int main(void)
{
    int n,j = 1;
    while(scanf("%d",&n) != EOF)
    {
        getchar();
        char ml[1000][100];
        int i, index = 0,tsc = 0;
        for(i = 0;i < n;i++)
        {
            gets(ml[i]);
            if(strcmp(ml[i],"Athletic goat") == 0)
            {
                index = 1;
                tsc += 10;
            }
            if(strcmp(ml[i],"Pleasant goat") == 0)
            {
                tsc += 5;
            }
            if(strcmp(ml[i],"Pretty goat") == 0)
            {
                tsc += 8;
            }
            if(strcmp(ml[i],"Lazy goat") == 0)
            {
                tsc += 15;
            }
            if(strcmp(ml[i],"Slow goat") == 0)
            {
                tsc += 20;
            }
        }
        if(n >= 10 && index == 1)
            tsc += 50;
        printf("Case #%d: %d\n",j++,tsc);
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 9