View Code of Problem 9

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k=1;
	string str1,str2;
	while(cin>>n)
	{
		int flag=0,score=0;
		for(int i=0;i<n;i++)
		{
			cin>>str1>>str2;
			switch(str1[3])
			{
				case 'a':
					score+=5;
					break;
				case 't':
					score+=8;
					break;
				case 'l':
					score+=10;
					flag=1;
					break;
				case 'y':
					score+=15;
					break;
				case 'w':
					score+=20;
					break;
			}
		}
		if(n>=10&&flag)
		{
			score+=50;
		}
		cout<<"Case #"<<k++<<": "<<score<<endl;
	}
}

Double click to view unformatted code.


Back to problem 9