View Code of Problem 9

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main(){
    int n,i=0,score=0,ath=0;
    char sheep[30];
    
    while(cin>>n){
        i++;
        score=0;
        for(int j=0;j<=n;j++){
           
            cin.getline(sheep,30);
            
            if(strcmp(sheep,"Pleasant goat")==0){
                score+=5;
            }
                else if(strcmp(sheep,"Pretty goat")==0){
                    score+=8;
                }
                else if(strcmp(sheep,"Athletic goat")==0){
                    score+=10;
                    ath=1;
                }
                else if(strcmp(sheep,"Lazy goat")==0){
                    score+=15;
                }
                else if(strcmp(sheep,"Slow goat")==0){
                    score+=20;
                }
        }
                         if(ath==1&&n>=10){
                             score+=50;
                         }
        cout<<"Case"<<" "<<"#"<<i<<":"<<" "<<score<<endl;
                         }
    
    return 0;
}

Double click to view unformatted code.


Back to problem 9