View Code of Problem 9

#include <iostream>
//#include <string>
#include <cstring>

using namespace std;

int main() {
	int n;
	int k=1;
	//cin >> n;
	while(cin >> n){
		char a[20];
		char b[20];
		//string a,b;
		int x=n,sum=0,flag=0;
		

		while(x>0){
			
			//cin >> a >> b;
			
			scanf("%s%s",&a,&b);
			if(strcmp(a,"Pleasant")==0)
				sum+=5;
			if(strcmp(a,"Pretty")==0)
				sum+=8;
			if(strcmp(a,"Athletic")==0){
				sum+=10;
				flag=1;
			}
			if(strcmp(a,"Lazy")==0)
				sum+=15;
			if(strcmp(a,"Slow")==0)
				sum+=20;
			
			
				
			--x;	
		}
		
		if(n>=10&&flag==1){
			sum+=50;
		}
		
		cout << "Case #"<< k << ": "<< sum <<endl;
		++k;
		
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 9