#include <stdio.h>
#include <string.h>
#define max 100
struct mobile
{
char computerShop[100];
int qty;
int price;
};
int main()
{
int choice, n;
char brand[max];
struct mobile m1[max];
printf("\n");
printf("Menu\n");
printf("1. Stock Entry\n2. Search & Display \n3.Exit\n");
while (1)
{
printf("Enter your choice: ");
scanf("%d", &choice);
switch (choice)
{
case 1:
{
printf("Enter the number of items you want to store: ");
scanf("%d",&n);
getchar();
printf("\n");
for (int i = 0; i < n; i++)
{
printf("Iteams name : ");
scanf("%s", &m1[i].computerShop);
printf("Quantity: ");
scanf("%d", &m1[i].qty);
printf("Price(Rs): ");
scanf("%d", &m1[i].price);
printf("\n");
}
break;
}
case 2:
{
printf("Enter iteams to search: ");
scanf("%s", &brand); //check here if error
for (int i = 0; i < n; i++)
{
if(strcmp(brand,m1[i].computerShop)==0)
{
printf("Stock in hand:%d\n", m1[i].qty);
printf("Total Cost of Inventory (Rs): %d\n", m1[i].qty * m1[i].price);
}
}
break;
}
case 3:
goto end;
default:
printf("\nEnter with in the choice list\n\n");
break;
}
}
end:
return 0;
}