Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

what's wrong with my code?????? #include #include #include #define MAXBINS 99 #define MAXCORS 26 #define MAXCUS 100 #define MAXPUR 10 /* datatype for a list

image text in transcribedwhat's wrong with my code??????

#include #include #include #define MAXBINS 99 #define MAXCORS 26 #define MAXCUS 100 #define MAXPUR 10

/* datatype for a list of orders ----------------- */

typedef struct { int bin_order_number; char bin_order_char; }bin_order; typedef struct { int orderNo; bin_order orderbin; }order; typedef struct { int cusnumber; int n; /* number of the orders what the txt include */ order oo[MAXPUR+1]; }customer; typedef struct{ int n; /*number of the customers */ customer cc[MAXCUS+1]; }orderlist_t;

int creatorderlist(orderlist_t *orderlist); void printorderlist(orderlist_t *orderlist, char *title);

int main(int argc, char *argv[]) { orderlist_t theorder; /*for stage 1*/ /* 1 ---------- creates the order list theorder */ creatorderlist(&theorder); /* 2 ---------- print the order list theorder */ printorderlist(&theorder,"STAGE 1"); /*for stage 2*/ return 0; }

int creatorderlist(orderlist_t *orderlist){ int i,p; int total_items=0; for(i=0; icc[i].cusnumber), &(orderlist->cc[i].n))==2; i++){ total_items=total_items+orderlist->cc[i].n; for (p=0;pcc[i].n && scanf("%d %d%s", &(orderlist->cc[i].oo[p].orderNo), &(orderlist->cc[i].oo[p].orderbin.bin_order_number), &(orderlist->cc[i].oo[p].orderbin.bin_order_char))==3; p++){ } } orderlist->n=i; return total_items; }

void printorderlist(orderlist_t *orderlist,char *title){ int i,p; /*firstly,print the tile and the header lines */ printf("%s ",title); printf("_______ "); printf(" orders: %d ",orderlist->n); printf(" items : %d ",creatorderlist(orderlist_t *orderlist)); /* then, print the order of each customer one by one*/ for(i=0;in;i++){ printf(" customer %d, %d items, bins:",orderlist->cc[i].cusnumber,orderlist->cc[i].n); for(p=0;pcs[i].oo[p].orderbin.bin_order_number, orderlist_t->cc[i].oo[p].orderbin.bin_order_char); } } printf(" "); }

C: Users Alienware gcc -Wall -o ass2 ass2. c ass2.c: In function creatorderlist ass2. c:57:14: error oderlist" undeclared (first use in this function) for p 0 p oderlist->cc li n && scanf %d 9%d%s ass2. c:57:14: note: each undeclared identifier is reported only once for each function it appears in ass2. C In function printorderlist' ass2. c:77:42: error: expected expression before orderlist t printf items %d creatorderlist (orderlist t*orderlist ass2. 81 28: error: expected expression before orderlist t for (p 0:p creat orderlist (orderlist t *order list) p++ ass2. c:82:20: error: expected expression before orderlist t printf %d%s order list t- cs il. oo [pl orderb in. bin order number

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Modeling And Design

Authors: Toby J. Teorey, Sam S. Lightstone, Tom Nadeau, H.V. Jagadish

5th Edition

0123820200, 978-0123820204

Students also viewed these Databases questions

Question

how would you have done things differently?

Answered: 1 week ago

Question

What were the reasons for your conversion or resistance?

Answered: 1 week ago