Code:
int main()
{
int counter = 0;
int number = 0;
int store_1[5] = {0, 0, 0, 0, -1];
int store_2[5] = {0, 0, 0, 0, -1];
int store_3[5] = {0, 0, 0, 0, -1];
char arrayfill = 0;
for (counter = 1; counter <=3; counter++)
{
int choice;
printf("Enter the number, from 1 to 3:\n");
choice = getchar();
switch(choice)
{
case '1':
arrayfill = '1';
printf("For the shop #1, enter number of T-shirts sold:\n");
scanf("%d%*c", &store_1[0]);
printf("Enter number of shorts sold:\n");
scanf("%d%*c", &store_1[1]);
printf("Enter number of sports shoes sold:\n");
scanf("%d%*c", &store_1[2]);
printf("Enter number of sports magazines sold:\n");
scanf("%d%*c", &store_1[3]);
break;
case '2':
arrayfill = '2';
printf("\nFor the shop #2, enter number of T-shirts sold:\n");
scanf("%d%*c", &store_2[0]);
printf("Enter number of shorts sold:\n");
scanf("%d%*c", &store_2[1]);
printf("Enter number of sports shoes sold:\n");
scanf("%d%*c", &store_2[2]);
printf("Enter number of sports magazines sold:\n");
scanf("%d%*c", &store_2[3]);
break;
case '3':
arrayfill = '3';
printf("\nFor the shop #3, enter number of T-shirts sold:\n");
scanf("%d%*c", &store_3[0]);
printf("Enter number of shorts sold:\n");
scanf("%d%*c", &store_3[1]);
printf("Enter number of sports shoes sold:\n");
scanf("%d%*c", &store_3[2]);
printf("Enter number of sports magazines sold:\n");
scanf("%d%*c", &store_3[3]);
default:
printf("It's not a correct number of your shop.\n");
}
}
return 0;
} /* end of main */