Posted: March 4th, 2025
Make an Inventory Program
Question description
FINAL INVENT.cpp #include#include#include#include#includechar item[3][10]={"Notebook", "Pencil", "Ballpen"}; //item[no. of strings][string length]int itemQty[3]={10, 15, 25};char password[] = "welcome1";int display(int itemNo){system("cls");printf("nt=======================================nt");printf("||| ITEM NAME | NEW STOCKS-ON-HAND |||nt");printf("===========================================nt");printf("||| %st |%d |||nt", item[itemNo], itemQty[itemNo]);printf("=======================================nnnt");system("pause");}int AddStock(){int qty, itemNo;qty=0;itemNo=0;while((itemNo<1)||(itemNo>3)){system("cls");printf("(1) Notebookn(2) Penciln(3) BallpennnEnter item #: ");scanf("%d", &itemNo);if((itemNo>=1)&&(itemNo<=3)){while(qty<1){system("cls");printf("nnEnter quantity: ");scanf("%d", &qty);if(qty<1){printf("nnInvalid input. Press any key to continue...");getch();}else{itemNo--;itemQty[itemNo]=itemQty[itemNo]+qty;display(itemNo);itemNo++;}}}else{printf("nnInvalid input. Press any key to continue...");getch();}}}int RemoveStock(){int qty, itemNo;qty=0;itemNo=0; while((itemNo<1)||(itemNo>3)){system("cls");printf("(1) Notebookn(2) Penciln(3) BallpennnEnter item #: ");scanf("%d", &itemNo);if((itemNo>=1)&&(itemNo<=3)){while(qty<1){system("cls");printf("nnEnter quantity: ");scanf("%d", &qty);if(qty<1){printf("nnInvalid input. Press any key to continue...");getch();}else if((qty3){ system("cls"); printf("nttt Inventory Program");printf("nnn Invalid password. Contact Technical Support Team at Extension 143. Thank you");exit_prog=1;}return(exit_prog);}int exitprogram(){ int exit_prog; char choice[1]; system("cls");printf("Are you sure you want to exit the program?"); scanf("%s", &choice); strupr(choice); if(!strcmp(choice, "Y")) { printf("Thank you for using the program."); exit_prog=1; } else if(!strcmp(choice, "N")) exit_prog=0; else { printf("Invalid input."); exit_prog=0; getch(); } return(exit_prog);}main(){int choice, exit_prog=0;char password[10]={"welcome1"}; exit_prog=login(); while(exit_prog==0){system("cls");printf("MAIN MENU");printf("n1. Add Stock");printf("n2. Remove Stock");printf("n3. Display Inventory");printf("n4. Change Password");printf("n5. Exit");printf("nnEnter choice: ");scanf("%d", &choice);switch(choice){case 1: AddStock(); break;case 2: RemoveStock(); break;case 3: DisplayInventory(); break;case 4: exit_prog=ChangePass(); break;case 5: exit_prog=exitprogram(); break;}}getch();}it was our final activity for this Sem..Something wrong with remove stock function.
Sample Essay, Assignments & Research Topics
Tags:
Academic Paper Assistance,
Assignment Help Australia,
Cheap Essay Writing Service,
Dissertation Writing Services