Write a program segment to display the content of the linked list.
Chapter16: Graphics
Section: Chapter Questions
Problem 17RQ
Related questions
Question
![Q2 Answer Q2(a)-Q(d) based on the information given in Figure Q2.
to record daily information of
at Liney Restaurant. The program creates a linked list in
/"This program is
meant
the menu
available
which each node contains data such as menu
name, price per unit,
preparation time, quantity ordered and a pointer. The declaration of
the structures MenuData and MenuNode are given in the program.*/
tinclude <stdio.h>
tinclude <string.h>
tinclude <stdlib.h>
#define SIZE 20
struct Menubata
char menuName (20];
double price PerUnit;
double prepzime;
int quantityordered,
typedef struct Menubata MenuData;
struct MenuNode
MenuData data;
struct MenuNode *next;
typedef struct Menutode MenuNode,
void showPrepTime (MenuNode *fftr):
int main ()
MenuNode *front = NULL, *newNodePtr;
MenuData input Data,
for (int i=l; i<=SIZE, i++)
printf ("\nEnter menu name: "):
gets (inputData.menuName):
printf ("\nEnter price per unit: ");
scanf ("$lf", 5inputData.pricePerUnit);
printf("\nEnter preparation time (hours): "):
scanf ("lf", &input Data.prepTime);
printf ("\nEnter quantity ordered: ");
scanf ("sd", sinputData.quantityordered) :
fflush (stdin):](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fcb300229-c43e-4a30-8491-f670d1fd48cb%2Fc53226da-9b7b-41bb-9c11-620943ce7ea1%2Fr0g89z_processed.png&w=3840&q=75)
Transcribed Image Text:Q2 Answer Q2(a)-Q(d) based on the information given in Figure Q2.
to record daily information of
at Liney Restaurant. The program creates a linked list in
/"This program is
meant
the menu
available
which each node contains data such as menu
name, price per unit,
preparation time, quantity ordered and a pointer. The declaration of
the structures MenuData and MenuNode are given in the program.*/
tinclude <stdio.h>
tinclude <string.h>
tinclude <stdlib.h>
#define SIZE 20
struct Menubata
char menuName (20];
double price PerUnit;
double prepzime;
int quantityordered,
typedef struct Menubata MenuData;
struct MenuNode
MenuData data;
struct MenuNode *next;
typedef struct Menutode MenuNode,
void showPrepTime (MenuNode *fftr):
int main ()
MenuNode *front = NULL, *newNodePtr;
MenuData input Data,
for (int i=l; i<=SIZE, i++)
printf ("\nEnter menu name: "):
gets (inputData.menuName):
printf ("\nEnter price per unit: ");
scanf ("$lf", 5inputData.pricePerUnit);
printf("\nEnter preparation time (hours): "):
scanf ("lf", &input Data.prepTime);
printf ("\nEnter quantity ordered: ");
scanf ("sd", sinputData.quantityordered) :
fflush (stdin):
![newNodePtr = malloc (sizeof (MenuNode) )
newNodePtr->data = inputData;
newNodeFtr->next = NULL;
if (front==NULL)
front = newNodePtr
else
newNodePtr->next = front;
front = newNodePtr;
return 0,
Figure Q2
(a)
Write a program segment to display the content of the linked list.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fcb300229-c43e-4a30-8491-f670d1fd48cb%2Fc53226da-9b7b-41bb-9c11-620943ce7ea1%2Fty99ipl_processed.png&w=3840&q=75)
Transcribed Image Text:newNodePtr = malloc (sizeof (MenuNode) )
newNodePtr->data = inputData;
newNodeFtr->next = NULL;
if (front==NULL)
front = newNodePtr
else
newNodePtr->next = front;
front = newNodePtr;
return 0,
Figure Q2
(a)
Write a program segment to display the content of the linked list.
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781305480537/9781305480537_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781305480537/9781305480537_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT