I have been given this question as an assignment but I haven't got very far, I don't know how to properly use a switch
function for this, and I'm not sure how to complete it. Can anyone help?
struct car
{
char model[50];
int manufacture_year;
float price;
};
int main()
{
int i;
int function;
struct car array[2];
for(i=0; i<2; i++) {
printf("what is the cars model? ");
scanf(" %s", &array[i].model);
printf("What year was the car manufactured? ");
scanf(" %d", &array[i].manufacture_year);
printf("How much does it cost? ");
scanf(" %f", &array[i].price);
printf("\n");
}
printf("press 1 to show model, 2 to show price and 3 to terminate");
scanf("%d", &function);
}
that's what I have so far... a switch is meant to come after I think.