Thread: Inventory System Help

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    May 2019
    Posts
    2

    Inventory System Help

    My team and I are instructed to make a c programming regarding an inventory system but we bump on some errors and i dont understand the nature of this error. The text folder are already made so may i know on what to improvise. Thank you.

    warning: format '%d' expects argument of type 'int *', but argument has type 'int'

    undefined reference to fprintf


    Code:
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <math.h>
    #include <conio.h>
    void record();
    void display();
    int ch;
    int no;
    int no2;
    int i;
    int c;
    int tools1,tools2,tools3;
    int day1,month1,year1;
    
    
    struct inventory
    {
            char fName1[50],fName2[50],lName1[50],lName2[50];
            int quantity1;
            int quantity2;
            int quantity3;
            int day1,month1,year1;
    }t1;
    
    
    int main()
    {
        tools1 = 10;
        tools2 = 10;
        tools3 = 10;
        do{
        do{
        printf("\t\t\tHello!\n\tWelcome to Laboratory Inventory System!\n\n");
        printf("Press number below according to the option below!\n");
        printf("\t1. Add Record\n\t2. Display Record\n\t3. Inventory Check\n");
        printf("Please enter your option?\n");
        switch(ch)
        {
            case 1:record();
            break;
    
    
            case 2:display();
            break;
    
    
            default: printf("\nInvalid Choice!\n");
            break;
        }
        }while(ch!=3);
        }while(tools1>0,tools2>0,tools3>0);
        system("cls");
        return 0;
    }
    void record()
    {
        FILE *fp;
        fp = fopen("LIBSUMP.txt", "w");
        for (i=0; i<no; i++)
        {
            printf("Please enter the first name of Person In Charge!(ex:Arif Imran).\n");
            scanf("%s %s",t1.fName1,t1.fName2);
            printf("Please enter the last name of Person In Charge!(ex:Ahmad Irfan).\n");
            scanf("%s %s",t1.lName1,t1.lName2);
            printf("Please enter the todays date!(ex:XX/YY/ZZZZ)\n");
            scanf("%d/%d/%d",&day1,&month1,&year1);
            int daysInMonth[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
            int n = day1;
            t1.day1 = day1 +7;
            if (( month1 == 2 ) && (day1 == 29))
            {
                // Leap year checking, if yes, Feb is 29 days.
                if(year1 % 400 == 0 || (year1 % 100 != 0 && year1 % 4 == 0))
                {
                    daysInMonth[1] = 29;
                }
            }
    
    
            if (t1.day1 > daysInMonth[month1 -1])
            {
                t1.day1 = (t1.day1-*daysInMonth);
                t1.month1 = month1 +1;
                if (month1 > 12)
                {
                    t1.month1 = 1;
                    t1.year1 = year1 +1;
                }
            }
            printf("Please enter the amount of tools needed!\n");
            printf("\nProjector\t:");
            scanf("%d",t1.quantity1);
            tools1=tools1-t1.quantity1;
            printf("\nProjection Screen\t:");
            scanf("%d",t1.quantity2);
            tools2=tools2-t1.quantity2;
            printf("\nSound System\t:");
            scanf("%d",t1.quantity3);
            tools3=tools3-t1.quantity3;
            fprintf(fp,"PIC\t\t:%s %s %s %s",t1.fName1,t1.fName2,t1.lName1,t1.lName2);
            fprintf(fp,"Due date\t\t: %d/%d/%d",t1.day1,t1.month1,t1.year1);
            fpritnf(fp,"Projector\t\t: %d",t1.quantity1);
            fprintf(fp,"Projection Screen\t\t: %d",t1.quantity2);
            fprintf(fp,"Sound System\t\t: %d",t1.quantity3);
        }
        fclose(fp);
    }
    void display()
    {
        FILE *fp;
        fp=fopen("LIBSUMP.txt","r");
        while((c=getc(fp))!=EOF)
        {
            printf("%c",c);
        }
        fclose(fp);
        getch();
        system("cls");
    }
    main.c
    Last edited by Salem; 05-07-2019 at 10:42 PM. Reason: Added [code][/code] tags, learn to use them yourself

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Book Inventory System
    By Tyler Small in forum C++ Programming
    Replies: 6
    Last Post: 11-12-2015, 09:49 PM
  2. problems with inventory system
    By a29bbas in forum C Programming
    Replies: 2
    Last Post: 01-07-2014, 11:50 AM
  3. Need help on Electronic Inventory System...
    By beh007 in forum C Programming
    Replies: 1
    Last Post: 12-27-2011, 08:42 PM
  4. Inventory System
    By headshot119 in forum C Programming
    Replies: 28
    Last Post: 09-24-2009, 10:53 AM
  5. inventory system
    By linucksrox in forum Game Programming
    Replies: 0
    Last Post: 04-19-2006, 01:19 PM

Tags for this Thread