#include <stdio.h>
#define SIZE 6
int
main (void)
{
// three parallel arrays
int codebar [6] = {262844, 717813, 980209, 762900, 462090, 320703};
double price[6] = {19.99, 23.75, 49.95, 60.00, 17.99, 99.95};
char size[6] = {'S','L','M','S','L','L'};
int code;
int i;
int product = -1;
printf ("Enter product code: ");
scanf ("%d", &code);
for (i=0; i < SIZE; ++i)
if (code == codebar[i])
product = i;
if (product == -1)
printf ("Product not found.\n");
else
{
printf ("Product code: %d.\n", codebar[product]);
printf ("Size: %c.\n", size[product]);
printf ("Price: $%0.2lf.\n", price[product]);
}
return (0);
}