Thread: Retail Outlet Managment System - the 4th

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    3

    I need an aid for my unfinished programming.

    It's due on midnight yesterday(11/10/07), so I lost a lot of points from this(maybe lost 70 out of 100). I cannot make up for this lost points, I think. Please somebody help me how to make my program run because it has a lot of error messages. I have updated followings today.

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <ctype.h>
    
    #define MAX_TBL_SIZE 30, MIN_STOCK_LEVEL 10 
    
    int index, number, input_item_id, input_item_stock, ItemId, Stock, Sufficient, 
       qty_sold, qty_new, input_item_id;;
    float UnitPrice;
    char file_name[100];
    int num, r, c;
    void ActionCode(int [8]);
    void input(int input_item_id[index], int input_item_stock[index], 
       float UnitPrice[index]);
    void CURRENTSTATUS(int ItemId[index], int Stock[index], int UnitPrice[index],
       char Sufficient);
     
    
    int main(void) {
       
       FILE *ifp;
      
       fprintf(stderr, "Enter the name of the input file: \n");
       fscanf(ifp, "&#37;d", &num);
       ifp = fopen("file_name", "r");
       ActionCode([8]);
       input(input_item_id, input_item_stock, UnitPrice);
       CURRENTSTATUS(ItemId, Stock, UnitPrice, Sufficient);
     
       system("PAUSE");
       return 0;
    }   
     
    void input(int input_item_id[index], int input_item_stock[index], float 
       UnitPrice[index]){
       while(input_item_id[index] != 0 && input_item_stock[index] != 0 
       && UnitPrice[index] != 0){
     
          fscanf(ifp, "%d", &input_item_id[index]);
          fscanf(ifp, "%d", &input_item_stock[index]);
          fscanf(ifp, "%f", &UnitPrice[index]);
    
          index++;
    } 
    
    void CURRENTSTATUS (int ItemId[index], int Stock[index], int 
       UnitPrice[index], char Sufficient){
       
       if(input_item_stock < MIN_STOCK_LEVEL)
          fprintf(stdout, "No", &Sufficient);            
       else
          fprintf(stdout, "Yes", &Sufficient);
          fprintf(stdout, "CURRENT STATUS\n");
          fprintf(stdout, "Id\tStock\tPrice\tSufficient\n");
          fprintf(stdout, "%d\t%d\t%.2f\t%c\n", ItemId[index], Stock[index],
          UnitPrice[index], Sufficient); 
    
    void ActionCode(int *){
       int [8] = {1, 2, 3, 4, 5, 6, 7, 8};
                     
       while ((c =fgetc(ifp)) != EOF) {   
          int number=1;
          switch (number){
    while(number != 0){
    
                case 1:
                   CURRENTSTATUS(ItemId, Stock, UnitPrice, Sufficient);                                 
                   break;
                case 2:
                   if(Stock[index] == 0)
                   fprintf(stdout, "There is no item with id %d.\n", 
                   ItemId[index]);
                   break; 
                case 3:
                   fprintf(ofp, "After sale, there are %d items with id %d.\n", 
                   qty_sold, ItemId);
             
                   if(qty_new < MIN_STOCK_LEVEL){
                   fprintf(stdout, "This product needs to be reordered.\n");
                   }
                   break;    
                case 4: /* input_item_id == 1 */ 
                   fprintf(ofp, "After purchase, there are %d items with id %d.\n", 
                   qty_new[index],ItemId[index]); 
                
                      if(qty_new < MIN_STOCK_LEVEL){
                      fprintf(stdout, "This product needs to be reordered.\n");
                      }
                   break;
                case 5:
                   if(qty_new < MIN_STOCK_LEVEL){
                      fprint(stdout, "Items to be reordered\n");
                      fprint(stdout, "%d\n", ItemId[index]);
                      }
                   break;
                case 6:
                   if  (qty_new <= 1){
                   printf("Lowest Stock: Only %d items left with id %d.\n", 
                   qty_new[index], ItemId[index]);
                   fprintf(stdout, "URGENT ORDER - this product needs to be"}; 
                   fprintf(stdout, "re-ordered\n"); 
                   fprintf(stdout, "immediately.\n");
                   }
                   break;
                case 7:
                   Unitprice[index] += (Stock[index]) * (UnitPrice[index]);
                   UnitPrice[index] += (Stock[index]) * (UnitPrice[index]);
                   fprintf(stdout, "Total price of all the items: $.2f\n", 
                   UnitPrice[index]);
                   break;
                case 8:
                   fprintf(stdout, "Good Bye!\n");
                   break;
             }  
          }        
       }
    }
    Followings are error messages:

    [code]
    23 G:\retail.c [Warning] built-in function 'index' declared as non-function
    G:\retail.c In function `main':
    42 G:\retail.c syntax error before '[' token
    43 G:\retail.c [Warning] passing arg 1 of `input' makes pointer from integer without a cast
    43 G:\retail.c [Warning] passing arg 2 of `input' makes pointer from integer without a cast
    43 G:\retail.c incompatible type for argument 3 of `input'
    44 G:\retail.c [Warning] passing arg 1 of `CURRENTSTATUS' makes pointer from integer without a cast
    44 G:\retail.c [Warning] passing arg 2 of `CURRENTSTATUS' makes pointer from integer without a cast
    44 G:\retail.c incompatible type for argument 3 of `CURRENTSTATUS'
    G:\retail.c In function `input':
    55 G:\retail.c `ifp' undeclared (first use in this function)
    (Each undeclared identifier is reported only once
    for each function it appears in.)
    G:\retail.c In function `CURRENTSTATUS':
    65 G:\retail.c `MIN_STOCK_LEVEL' undeclared (first use in this function)
    G:\retail.c In function `ActionCode':
    74 G:\retail.c parameter name omitted
    75 G:\retail.c syntax error before '[' token
    G:\retail.c In function `CURRENTSTATUS':
    117 G:\retail.c `ofp' undeclared (first use in this function)
    134 G:\retail.c subscripted value is neither array nor pointer
    163 G:\retail.c subscripted value is neither array nor pointer
    164 G:\retail.c syntax error before '}' token
    178 G:\retail.c `Unitprice' undeclared (first use in this function)
    Last edited by Presidentofusa; 11-11-2007 at 12:25 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem building Quake source
    By Silvercord in forum Game Programming
    Replies: 16
    Last Post: 07-11-2010, 09:13 AM
  2. Why Can't C++ Be Used to Develop Operating System?
    By Antigloss in forum C++ Programming
    Replies: 7
    Last Post: 05-27-2005, 06:16 AM
  3. Operating system construction
    By AdamLAN in forum Tech Board
    Replies: 7
    Last Post: 03-05-2005, 01:31 PM
  4. exe files in -c- language
    By enjoy in forum C Programming
    Replies: 6
    Last Post: 05-18-2004, 04:36 PM