View Code of Problem 9

#include <stdio.h>
#include <string.h>

int main(){
    int mark=0;
    int count = 0;
    int cnt = 0;
    int flag = 0;
    int num;
    char c[15], d[15];
    scanf("%d",&num);
    do{

            while(num>0){
                scanf("%s %s",&c,&d);
                if(strcmp(c,"Pleasant") == 0){
                    mark+=5;
                    count ++;
                }else if(strcmp(c,"Pretty")==0){
                    mark+=8;
                    count ++;
                }else if(strcmp(c,"Athletic")==0){
                    flag = 1;
                    mark+=10;
                    count ++;
                }else if(strcmp(c,"Lazy")==0){
                    mark+=15;
                    count ++;
                }else if(strcmp(c,"Slow")==0){
                    mark+=20;
                    count ++;
                }
                num --;
            }

            cnt ++;
            if(count >= 10 &&flag == 1){
                mark += 50;
            }
            printf("Case #%d:%d\n",cnt,mark);
            mark = 0;

    }while(scanf("%d",&num)!= EOF);

    return 0;
}

Double click to view unformatted code.


Back to problem 9