Help fill in code!
#if !defined(PRODUCE_H_INCL)
#define PRODUCE_H_INCL
#define PRODUCE_NAME 21
typedef struct produce {
char name[PRODUCE_NAME];
int inven;
} produce_t;
typedef struct list_node {
produce_t data;
struct list_node *restp;
} list_node_t;
typedef struct produce_list {
/* fill in the code to declare a list_node_t pointer called head */
int size;
} produce_list_t;
void read_produce_file (char filename[], produce_list_t *p);
void print_produce (produce_t prod);
void print_produce_list (produce_list_t p);
void write_produce_file (char filename[], produce_list_t p);
list_node_t * search_produce_list (produce_list_t p, char name[]);
int update_produce_list (produce_list_t *p, produce_t prod);
void print_produce_linked_list (produce_list_t p);
#endif
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 2 images
- in c language !! typedef struct {long restaurant_id;char restaurant_name[10];char description[120];double rate;char cuisine[30]; opening_year;long capacity;char city[30];char address[60];char owner[30];} RECORD_t, *RECORD; RECdelete (unsigned long restaurant_id, RECORD *restaurant_array, unsigned long *p_size){int rec;int index;// index <- find the index of the RECORD with given restaurant_id in restaurant_array ????? (I DIDNT)if (index is valid)rec=restaurant_array[index];elserec=NULL;return rec;}arrow_forwardT/F The << operator is overloaded to input data items of fundamental types, strings and pointer valuesarrow_forward#include <iostream> #include<string.h> //user-defined functions question! using namespace std; struct Books { char title[50]; char author[50]; char subject[100]; int book_id; }; int main() { double array1[5]= {13.768,4.0,88.7689,9.12,}; struct Books Book1; strcpy( Book1.title, "C++ Programming"); strcpy( Book1.author, "D.S Malik"); strcpy( Book1.subject, "C++ basics"); Book1.book_id = 6495407; ////Block#1////// int x=4; for (x; x>=0; x--){ cout<<array1[x]<<endl; //////////////////////////////// } cout<<"///////////////////////"<<endl; ////end of Block#1////// ////Block#2////// int sum=0, i=0; for (i; i<5; i++){ cout<<static_cast<int>(array1[i])<<" "; sum= sum+array1[i]; cout<<sum<<endl; } cout<< "final value of sum="<<" "<<sum<<endl; cout<< "the average value ="<<" " <<sum/5 <<endl; cout<<"//////////////////////"<<endl; //arrow_forward
- #include <iostream> #include<string.h> //user-defined functions question! using namespace std; struct Books { char title[50]; char author[50]; char subject[100]; int book_id; }; int main() { double array1[5]= {13.768,4.0,88.7689,9.12,}; struct Books Book1; strcpy( Book1.title, "C++ Programming"); strcpy( Book1.author, "D.S Malik"); strcpy( Book1.subject, "C++ basics"); Book1.book_id = 6495407; ////Block#1////// int x=4; for (x; x>=0; x--){ cout<<array1[x]<<endl; //////////////////////////////// } cout<<"///////////////////////"<<endl; ////end of Block#1////// ////Block#2////// int sum=0, i=0; for (i; i<5; i++){ cout<<static_cast<int>(array1[i])<<" "; sum= sum+array1[i]; cout<<sum<<endl; } cout<< "final value of sum="<<" "<<sum<<endl; cout<< "the average value ="<<" " <<sum/5 <<endl; cout<<"//////////////////////"<<endl; //arrow_forwardIn C, using malloc to allocate memory for a linked list uses which memory allocation scheme? Heap allocation Static allocationarrow_forwardNonearrow_forward
- please go in to the detail and explain the purpose and function to each line & function of code listed below. Dsecribe each line. #include <stdio.h>//including headers#include <string.h>#include <stdlib.h> struct node{//structure intialization int data; struct node *next; }; #include <assert.h> typedef struct Info_ { char name[100]; } Info; typedef struct Compar_ { Info info; struct Compar_* next; } Compar; void print_comparisons(Compar* CP)//comparison method { assert(CP); Compar* cur = CP; Compar* next = cur->next; for (; next; cur = next, next = next->next) { if (strcmp(cur->info.name, next->info.name) == 0) printf("Same name\n"); else printf("Diff name\n"); } } struct node *head, *tail = NULL; void addNode(int data) {//adding node method struct node *newNode = (struct node*)malloc(sizeof(struct node)); newNode->data = data; newNode->next = NULL; if(head == NULL) { head = newNode; tail = newNode; } else { tail->next =…arrow_forward3arrow_forwardC++ PROGRAMMINGTopic: Binary Search Trees Explain the c++ code below.: SEE ATTACHED PHOTO FOR THE PROBLEM INSTRUCTIONS It doesn't have to be long, as long as you explain what the important parts of the code do. (The code is already implemented and correct, only the explanation needed) #include "node.h" #include <iostream> using namespace std; class BTree { node* root; int size; node* create_node(int num, node* parent) { node* n = (node*) malloc( sizeof(node) ); n->element = num; n->parent = parent; n->right = NULL; n->left = NULL; return n; } public: BTree() { root = NULL; size = 0; } node* left(node* p) { return p->left; } node* right(node* p) { return p->right; } node* sibling(node* p){ if(p != root){ node* P = p->parent; if(P->left != NULL && P->right != NULL){…arrow_forward
- #include <iostream> #include <iomanip> #include <string> using namespace std; struct Teletype { string name; string phonenum; Teletype *nextaddr; }; void populate(Teletype *); void displayrecord(Teletype *); //void insertrecord(Teletype *); // create //void removerecord(Teletype *); //create //void modifyrecord(Teletype *); // create //int find(TeleType *, string); // Extra Credit create bool check(); int main() { int location = 0; int count = 0; char answery_n; Teletype *list, *current; list = new Teletype; current = list; cout << "Please "; do { count++; populate(current); if (check() == false) { cout << " Not storage available" << endl; } else { current->nextaddr = new Teletype; current = current->nextaddr;…arrow_forwardlanguage carrow_forward6. sum_highest_five This function takes a list of numbers, finds the five largest numbers in the list, and returns their sum. If the list of numbers contains fewer than five elements, raise a ValueError with whatever error message you like. Sample calls should look like: >>> sum_highest_five([10, 10, 10, 10, 10, 5, -17, 2, 3.1])50>>> sum_highest_five([5])Traceback (most recent call last): File "/usr/lib/python3.8/idlelib/run.py", line 559, in runcode exec(code, self.locals) File "<pyshell#44>", line 1, in <module> File "/homework/final.py", line 102, in sum_highest_five raise ValueError("need at least 5 numbers")ValueError: need at least 5 numbersarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education