Currently I'm making a storage program, but it still print 1, when I already add an item. Can someone tell me what's wrong with this code?
Direction: Input Storage (1-10) enter 1 -> Add Item (enter anything) -> Back to main menu -> Show Item
#include <stdio.h>
#include <stdlib.h>
struct info1
{
int quantity2;
char name[60];
};
int main(void)
{
start: ;
struct info1 item1;
struct info1 item2;
struct info1 item3;
struct info1 item4;
struct info1 item5;
struct info1 item6;
struct info1 item7;
struct info1 item8;
struct info1 item9;
struct info1 item10;
int quantity1, mainmenu;
item1.quantity2 = 0;
item2.quantity2 = 0;
item3.quantity2 = 0;
item4.quantity2 = 0;
item5.quantity2 = 0;
item6.quantity2 = 0;
item7.quantity2 = 0;
item8.quantity2 = 0;
item9.quantity2 = 0;
item10.quantity2 = 0;
printf("\n==Storage==");
printf("\n\nInput Storage (1-10) : ");
scanf("%d", &quantity1);
printf("\nMain Menu\n1.Add Item\n2.Show Item\n3.Search Item\n4.Exit\n");
scanf("%d", &mainmenu);
if (quantity1 == 1)
{
if (mainmenu == 1)
{
printf("\nItem Name : ");
scanf("%s", item1.name);
fflush(stdin);
printf("\nItem Quantity : ");
scanf("%d", &item1.quantity2);
}
else if (mainmenu == 2)
{
printf("\n==Item List==");
if (item1.quantity2 == 0)
{
printf("\n1. - ");
}
else if (item1.quantity2 > 0)
{
printf("\n1. %s %d pcs", item1.name, item1.quantity2);
}
}
}
goto start;
}