Question

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 \n 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​what's wrong with my code??????

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
                          
#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;
  i<MAXCUS && scanf("%d %d",
   &(orderlist->cc[i].cusnumber),
   &(orderlist->cc[i].n))==2;
   i++){
  total_items=total_items+orderlist->cc[i].n;
  for (p=0;p<oderlist->cc[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\n",title);
printf("_______\n");
printf(" orders: %d \n",orderlist->n);
printf(" items : %d \n",creatorderlist(orderlist_t *orderlist));
/* then, print the order of each customer one by one*/
for(i=0;i<orderlist->n;i++){
  printf("   customer %d, %d items, bins:",orderlist->cc[i].cusnumber,orderlist->cc[i].n);
  for(p=0;p<creatorderlist(orderlist_t *orderlist);p++){
   printf(" %d%s ",orderlist_t->cs[i].oo[p].orderbin.bin_order_number,
       orderlist_t->cc[i].oo[p].orderbin.bin_order_char);
  }
}
printf("\n");
}

0 0
Add a comment Improve this question Transcribed image text
Answer #1

ERROR1: ass2.c:57:14 Spelling mistake: 'oderlist' ==> 'orderlist'

ERROR2: ass2.c:77:42: Syntax error: creatorderlist(orderlist_t *orderlist) ==> creatorderlist(*orderlist)

ERROR3: ass2.c:81:28: Syntax error: creatorderlist(orderlist_t *orderlist) ==> creatorderlist(*orderlist)

ERROR4: ass2.c:82:20: Spelling mistake(use object not struct):

orderlist_t->cs[i].oo[p].orderbin.bin_order_number ==>

orderlist->cs[i].oo[p].orderbin.bin_order_number

DO THUMBS UP ^_^

Add a comment
Know the answer?
Add Answer to:
​what's wrong with my code?????? #include <stdio.h> #include <stdlib.h> #include <string.h>                         &
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • #include <stdio.h> #include <string.h> #include <ctype.h> #include <stdlib.h> int main(void) { /* Type your code here....

    #include <stdio.h> #include <string.h> #include <ctype.h> #include <stdlib.h> int main(void) { /* Type your code here. */ int GetNumOfNonWSCharacters(const char usrStr[]) { int length; int i; int count = 0; char c; length=strlen(usrStr); for (i = 0; i < length; i++) { c=usrStr[i]; if ( c!=' ' ) { count++; } }    return count; } int GetNumOfWords(const char usrStr[]) { int counted = 0; // result // state: const char* it = usrStr; int inword = 0; do switch(*it)...

  • Please explain how these code run for each line #include<stdio.h> #include<string.h> /** * Part A */...

    Please explain how these code run for each line #include<stdio.h> #include<string.h> /** * Part A */ struct myWord{    char Word[21];    int Length; }; int tokenizeLine(char line[], struct myWord wordList[]); void printList(struct myWord wordList[], int size); void sortList(struct myWord wordList[], int size); /** * main function */ int main() {    struct myWord wordList[20];    char line[100];    printf("Enter an English Sentence:\n");    gets(line);    int size = tokenizeLine(line, wordList);    printf("\n");    printf("Unsorted word list.\n");    printList(wordList, size);...

  • Finish function to complete code. #include <stdio.h> #include <stdlib.h> #include<string.h> #define Max_Size 20 void push(char S[],...

    Finish function to complete code. #include <stdio.h> #include <stdlib.h> #include<string.h> #define Max_Size 20 void push(char S[], int *p_top, char value); char pop(char S[], int *p_top); void printCurrentStack(char S[], int *p_top); int validation(char infix[], char S[], int *p_top); char *infix2postfix(char infix[], char postfix[], char S[], int *p_top); int precedence(char symbol); int main() { // int choice; int top1=0; //top for S1 stack int top2=0; //top for S2 stack int *p_top1=&top1; int *p_top2=&top2; char infix[]="(2+3)*(4-3)"; //Stores infix string int n=strlen(infix); //length of...

  • Need help for C program. Thx #include <stdio.h> #include <string.h> #include <ctype.h> // READ BEFORE YOU...

    Need help for C program. Thx #include <stdio.h> #include <string.h> #include <ctype.h> // READ BEFORE YOU START: // This homework is built on homework 06. The given program is an updated version of hw06 solution. It begins by displaying a menu to the user // with the add() function from the last homework, as well as some new options: add an actor/actress to a movie, display a list of movies for // an actor/actress, delete all movies, display all movies,...

  • Deleting multiples of a given integer from a linked list: #include <stdio.h> #include <stdlib.h> #include <assert.h>...

    Deleting multiples of a given integer from a linked list: #include <stdio.h> #include <stdlib.h> #include <assert.h> #define MAX 10000 typedef struct node_tag { int v; // data struct node_tag * next; // A pointer to this type of struct } node; // Define a type. Easier to use. node * create_node(int v) { node * p = malloc(sizeof(node)); // Allocate memory assert(p != NULL); // you can be nicer // Set the value in the node. p->v = v; p->next...

  • Question 1 Consider the following program fragment that defines a self-referential class: #include <stdlib.h> #include <stdio.h>...

    Question 1 Consider the following program fragment that defines a self-referential class: #include <stdlib.h> #include <stdio.h> struct node_int; typedef struct node int *node; struct node_int void *data; node next; typedef struct list_int (node first;} *list; void main(int argc, char *argv[]) list shopping, t; node n; int x=25; shopping=(list) malloc(sizeof(struct list_int)); n= (node) malloc(sizeof(struct node_int)); n->data=shopping; n->next=NULL; shopping->first=n; t=(list) (shopping->first->data); // ***** t->first=NULL; // ***** n->data=&x; printf("%d\n", *((int *) (shopping->first->data))); a What will be displayed on the screen if the above...

  • Fix the errors in C code #include <stdio.h> #include <stdlib.h> void insertAt(int *, int); void Delete(int...

    Fix the errors in C code #include <stdio.h> #include <stdlib.h> void insertAt(int *, int); void Delete(int *); void replaceAt(int *, int, int); int isEmpty(int *, int); int isFull(int *, int); void removeAt(int *, int); void printList(int *, int); int main() { int *a; int arraySize=0,l=0,loc=0; int choice; while(1) { printf("\n Main Menu"); printf("\n 1.Create list\n 2.Insert element at particular position\n 3.Delete list.\n4. Remove an element at given position \n 5.Replace an element at given position\n 6. Check the size of...

  • Explain the code and analyze the performance of algorithm #include<stdio.h> #include<string.h> #define NUM 1...

    Explain the code and analyze the performance of algorithm #include<stdio.h> #include<string.h> #define NUM 100 #define maxint 10000 void dijkstra(int n,int v,int dist[],int prev[],int c[][NUM]) {    int i,j;    bool s[NUM];    for(i=1; i<=n; i++)    {        dist[i] = c[v][i];        s[i] = false;        if (dist[i]>maxint) prev[i] = 0;        else prev[i] = v;    }    dist[v] = 0;    s[v] = true;    for(i=1; i<n; i++)    {        int tmp = maxint;        int u = v;        for(j=1; j<=n; j++)            if(!(s[j]) && (dist[j]<tmp))            {                u = j;                tmp = dist[j];           ...

  • Would u help me fixing this CODE With Debugging Code with GDB #include <stdio.h> #include <stdlib.h>...

    Would u help me fixing this CODE With Debugging Code with GDB #include <stdio.h> #include <stdlib.h> #define SIZE (10) typedef struct _debugLab { int i; char c; } debugLab; // Prototypes void PrintUsage(char *); void DebugOption1(void); void DebugOption2(void); int main(int argc, char **argv) { int option = 0; if (argc == 1) { PrintUsage(argv[0]); exit(0); } option = atoi(argv[1]); if (option == 1) { DebugOption1(); } else if (option == 2) { DebugOption2(); } else { PrintUsage(argv[0]); exit(0); } }...

  • GIVEN CODE- FILL IN THE BLANK! #include <fcntl.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <string.h>...

    GIVEN CODE- FILL IN THE BLANK! #include <fcntl.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/wait.h> // Function ptototypes int readX(); void writeX(int); int main() /// chi read x ---> divi ---> write x into file ---> par read x --> sub--> write x into file---> chi read x-->etc {    int pid;           // pid: used to keep track of the child process    int x = 19530;       // x: our value as integer   ...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT