You 5 minutes ago Write a program segment to display the names and price per unit fo products in the linked list with the quantity less than five.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Please answer quickly
U Mobile Stay Safe VOLTE 4 a 1.70K/s O X 7 0943
You
5 minutes ago
Write a program segment to display the names and price per unit for all
products in the linked list with the quantity less than five.
(b)
Transcribed Image Text:U Mobile Stay Safe VOLTE 4 a 1.70K/s O X 7 0943 You 5 minutes ago Write a program segment to display the names and price per unit for all products in the linked list with the quantity less than five. (b)
Q1
Answer Q1(a)-QI(c) based on the information given in FIGURE QI.
/*This program allows user to enter product information to be
stored in a linked list. Each product information contains
product name, quantity, and price per unit.*/
#include <stdio.h>
#include <stdlib.h>
tinclude <string.h>
#define MAXX_NUM 5
int main ()(
struct Product (
char name [20];
int quantity:
double unitPrice;
//product name
1/quantity
//price per unit
typedef struct Product Product;
struct Node{
Product myProduct;
struct Node *next;
typedef struct Node Node;
Node *front = NULL, "ptrl;
char inputName [20];
int inputQuantity:
double inputUnitPrice;
int i:
for (i=1; i<=MAX_NUM; i++)
printf("\nEnter product name: ");
scanf ("ss", sinputName);
printf("\nEnter quantity: ");
scanf ("d", GinputQuantity);
printf("\nEnter price per unit: ");
scanf ("lf", sinputUnitPrice);
ptrl = malloc (sizeof (Node));
strepy (ptrl->myProduct.name, inputName);
ptrl->myProduct.quantity = inputQuantity;
ptrl->myProduct.unitPrice = inputUnitPrice;
ptrl ->next - NULL;
if (front !- NULL)
ptrl->next - front;
front - ptrl;
return 0;}
FIGURE Q1
Transcribed Image Text:Q1 Answer Q1(a)-QI(c) based on the information given in FIGURE QI. /*This program allows user to enter product information to be stored in a linked list. Each product information contains product name, quantity, and price per unit.*/ #include <stdio.h> #include <stdlib.h> tinclude <string.h> #define MAXX_NUM 5 int main ()( struct Product ( char name [20]; int quantity: double unitPrice; //product name 1/quantity //price per unit typedef struct Product Product; struct Node{ Product myProduct; struct Node *next; typedef struct Node Node; Node *front = NULL, "ptrl; char inputName [20]; int inputQuantity: double inputUnitPrice; int i: for (i=1; i<=MAX_NUM; i++) printf("\nEnter product name: "); scanf ("ss", sinputName); printf("\nEnter quantity: "); scanf ("d", GinputQuantity); printf("\nEnter price per unit: "); scanf ("lf", sinputUnitPrice); ptrl = malloc (sizeof (Node)); strepy (ptrl->myProduct.name, inputName); ptrl->myProduct.quantity = inputQuantity; ptrl->myProduct.unitPrice = inputUnitPrice; ptrl ->next - NULL; if (front !- NULL) ptrl->next - front; front - ptrl; return 0;} FIGURE Q1
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY