Question: fix the errors. /* */ #include void printInput(int n); void readInventory(int n); void printInput(struct item, int n); int readNumberOfItems(); struct details; int readNumberOfItems(); // main

fix the errors.

/*

*/

#include

void printInput(int n);

void readInventory(int n);

void printInput(struct item, int n);

int readNumberOfItems();

struct details;

int readNumberOfItems();

// main function

void main()

{

struct details item[50];

int n;

// a function to take in numbers

n = readNumberOfItems();

// reads in the imput from user

readInventory(item, n);

// prints input

printInput(item, n);

}

struct date // struct this is the date function

{

int d;

int month;

int year;

};

struct details // struct for the item of an item

{

char product[20];

int price;

int code;

int qty;

struct date cart;

};

// function to read the number of items

int readNumberOfItems()

{

int n;

printf("How many: ");

scanf("%d", &n);

fflush(stdin);

return n;

}

void readInventory(struct details item[50], int n) // this fuction takes in the item information

{

int i;

for (i = 0; i < n; i++)

{

fflush(stdin);

printf(" Product name: ");

scanf("%s", item[i].product);

fflush(stdin);

printf("ID #: ");

scanf("%d", &item[i].code);

fflush(stdin);

printf("How many: ");

scanf("%d", &item[i].qty);

fflush(stdin);

printf("Cost: ");

scanf("%d", &item[i].price);

fflush(stdin);

printf("Made on(mm/dd/yy: ");

scanf("%d-%d-%d", &item[i].cart.d, &item[i].cart.month, &item[i].cart.year);

}

}

// function to diplay the inventory

void printInput(struct details item[50], int n)

{

int i;

printf(" welcome to the updated/ completely new cart ");

printf("S.N.| product name ID How many Cost cart.DATE ");

for (i = 0; i < n; i++)

printf("%-4d %-12s %-6d %-8d %-8d %d/%d/%d ", (i + 1), item[i].product, item[i].code, item[i].qty, item[i].price, item[i].cart.d, item[i].cart.month, item[i].cart.year);

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!