Code:
"#include<string.h>
#include <stdio.h>
int main(void)
{
int a;
int vote[50] =
{9,3,10,6,55,9,7,3,3,27,15,4,4,21,11,7,6,8,9,4,10,12,17,10,6,11,3,5,5,4,15,5,31,15,3,20,7,7,21,4$
char state[2];
printf(" Please enter a state abv in lower case or EOF
to quit\n");
while((state[2] = getchar()) != 99)
{
switch(state[2])
{
case 'al':
printf("The State of alabama has %d electoral votes\n",vote[0]);
break;
case 'ak':
printf("The State of alaska has %d electoral votes\n",vote[1]);
break;
case 'az':
printf("The State of arizona has %d electoral votes\n",vote[2]);
break;
case 'ar':
printf("The State of arkansas has %d electoral votes\n",vote[3]);
break;
case 'ca':
printf("The State of california has %d electoral votes\n",vote[4]);
break;
case 'co':
printf("The State of colorado has %d electoral votes\n",vote[5]);
break;
default:
printf("error\n");
break;
}
}
return 0;
}"