WRITE IN C PROGRAMMING LANGUAGE PLEASE RUN IT ON MATRIX Pro

WRITE IN C PROGRAMMING LANGUAGE & PLEASE RUN IT ON MATRIX

Program completion

Your program is complete if your output matches the following output. bold numbers show the user’s input.

Start OUPUT
><

><

><

><

><

><

><

><

><

><

><

><

><

><

><

><

><

><

><

><

>Welcome to the Shop

>===================

>Please select from the following options:

>1) Display the inventory.

>2) Add to the inventory.

>3) Check price.

>4) Clear Screen.

>0) Exit.

>Select: 5

>Invalid input, try again: 2

>Please input a SKU number: 1234

>Quantity: 2

>Price: 45.63

>The item is successfully added to the inventory.

>Please select from the following options:

>1) Display the inventory.

>2) Add to the inventory.

>3) Check price.

>4) Clear Screen.

>0) Exit.

>Select: 2

>Please input a SKU number: 9010

>Quantity: 5

>Price: 23.50

>The item is successfully added to the inventory.

>Please select from the following options:

>1) Display the inventory.

>2) Add to the inventory.

>3) Check price.

>4) Clear Screen.

>0) Exit.

>Select: 2

>Please input a SKU number: 1234

>Quantity: 5

>The item exists in the repository, quantity is updated.

>Please select from the following options:

>1) Display the inventory.

>2) Add to the inventory.

>3) Check price.

>4) Clear Screen.

>0) Exit.

>Select: 1

><

><

>Inventory

>=========================================

>Sku         Price       Quantity

>1234        45.63       7

>9010        23.50       5

>=========================================

>Please select from the following options:

>1) Display the inventory.

>2) Add to the inventory.

>3) Check price.

>4) Clear Screen.

>0) Exit.

>Select: 0

>Goodbye!
><

Solution

#include <stdio.h>
#include <conio.h>

void main()
{
struct date
{
int day;
int month;
int year;
};

struct details
{
char name[20];
int price;
int code;
int qty;
struct date mfg;
};

struct details item[50];
int n,i;

clrscr();

printf(\"Enter number of items:\");
scanf(\"%d\",&n);
fflush(stdin);

for(i=0;i<n;i++)
{
fflush(stdin);
printf(\"Item name:\");
scanf(\"%[^\ ]\",item[i].name);

fflush(stdin);
printf(\"Item code:\");
scanf(\"%d\",&item[i].code);
fflush(stdin);

printf(\"Quantity:\");
scanf(\"%d\",&item[i].qty);
fflush(stdin);

printf(\"price:\");
scanf(\"%d\",&item[i].price);
fflush(stdin);

printf(\"Manufacturing date(dd-mm-yyyy):\");
scanf(\"%d-%d-%d\",&item[i].mfg.day,&item[i].mfg.month,&item[i].mfg.year);
}
printf(\" ***** INVENTORY *****\ \");
printf(\"------------------------------------------------------------------\ \");
printf(\"S.N.| NAME | CODE | QUANTITY | PRICE |MFG.DATE\ \");
printf(\"------------------------------------------------------------------\ \");
for(i=0;i<n;i++)
printf(\"%d %-15s %-d %-5d %-5d %d/%d/%d\ \",i+1,item[i].name,item[i].code,item[i].qty,item[i].price,
item[i].mfg.day,item[i].mfg.month,item[i].mfg.year);
printf(\"------------------------------------------------------------------\ \");
getch();
}

WRITE IN C PROGRAMMING LANGUAGE & PLEASE RUN IT ON MATRIX Program completion Your program is complete if your output matches the following output. bold numb
WRITE IN C PROGRAMMING LANGUAGE & PLEASE RUN IT ON MATRIX Program completion Your program is complete if your output matches the following output. bold numb
WRITE IN C PROGRAMMING LANGUAGE & PLEASE RUN IT ON MATRIX Program completion Your program is complete if your output matches the following output. bold numb
WRITE IN C PROGRAMMING LANGUAGE & PLEASE RUN IT ON MATRIX Program completion Your program is complete if your output matches the following output. bold numb

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site