Struct Inventory (Char Product (Struct Inventory S (
Struct Inventory (Char Product (Struct Inventory S (
h> struct inventory{ char product[100]; int quantity; double price;}; struct inventory s[100]; main() { int a,b,i,j,k,l,e; char c[100], d[100],password[100]; double total,sum; printf("Enter password: "); scanf("%s",password); if(!strcmp(password,"Fullstop.")) { for(;;) { system("cls"); printf("\n\n\t\t\t\tMain Menu\n\n\n1. Enter product(s)\n\n2. Change Inventory\n\n3. Make Sale(s)\n\n4. Inventory Report\n\n5. Exit\n\n\n"); printf("Your Option: "); scanf("%d",&a); if(a==1) {system("cls"); printf("Enter the Number of products you want to input: "); scanf("%d",&k); system("cls"); for(i=0; i<k; i++) {printf("Enter Name: "); scanf("%s",&s[i].product); printf("\nEnter Quantity: "); scanf("%d",&s[i].quantity); printf("\nEnter Price per unit: "); scanf("%lf",&s[i].price); printf("\n");} system("cls"); printf("Products are successfully Saved in the Inventory.\n\n\n\n\nPress Enter to go back to the Main Menu."); getch();} if(a==2) { for(;;) {system("cls"); printf("Enter the product name that you want to Change :\n"); scanf("%s",&c); printf("Enter the number of quantities you want to further add :\n"); scanf("%d",&b); for(i=0; i<6; i++) { if(!strcmp(c,s[i].product)) { s[i].quantity=s[i].quantity+b; printf("Product Name: %s\nQuantity %d\nPrice %.2lf\n\n",s[i].product,s[i].quantity,s[i].price); }}getch(); system("cls"); printf("If you want to alter any other products then\nPress '1' for Yes\nPress '2' for No\nYour choice: "); scanf("%d",&e); if(e==1) continue; else system("cls"); printf("Inventory Upgraded.\n\n\n\nPress Enter to go back to the Main Menu."); getch();
break;}} if(a==3) { for(;;) {system("cls"); printf("Enter the product name you want to sell: "); scanf("%s",&d); printf("Enter the number of quantites you want to sell: "); scanf("%d",&l); for(i=0; i<k; i++) { if(!strcmp(d,s[i].product)) {if((s[i].quantity-l)>=0) {s[i].quantity=s[i].quantity-l; system("cls"); printf("Product Name: %s\nQuantity: %d\n Price: %.2lf\n",s[i].product,s[i].quantity,s[i].price); getch();} else printf("\nQuantity sold cannot be more than quantity present"); getch(); }} system("cls"); printf("If you want to make sale again then\nPress '1' for Yes\nPress '2' for No\nYour choice: "); scanf("%d",&e); if(e==1) continue; else system("cls"); printf("Inventory Upgraded.\n\n\n\n\nPress Enter to go back to the Main Menu."); getch(); break;}} if(a==4) {system("cls"); for(i=0; i<k; i++) {sum=s[i].quantity*s[i].price; total = total + sum; printf("Product Name: %s\nQuantity: %d\nPrice Per Unit: %.2lf\n",s[i].product,s[i].quantity,s[i].price); } printf("Total Bill = %.2lf\n\n\n\n\nPress Enter to go back to the Main Menu.",total);} getch(); if(a==5) {system("cls"); printf("Press Enter to Shut Down."); exit(0);}}} else printf("\nWRONG PASSWORD\n"); exit (0); }