C programming problem

This is a discussion on C programming problem within the C Programming forums, part of the General Programming Boards category; This program has to handle a retail company's inventory control system. I am supposed to create a singly linked list ...

  1. #1
    Unregistered
    Guest

    C programming problem

    This program has to handle a retail company's inventory control system. I am supposed to create a singly linked list to store and manipulate a company's inventory product records. Basically each node in a linked list is a struct that contains a product's name, and unit price, and quantity in stock. In addition each node has a pinter, called pNext, that points to the next node int he list. The last node's pNext should be NULL. How am I to implement teh function prototypes?

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include "irecord.h"

    main(void)
    (
    int iNum,i;
    char Name[NAMESIZE];
    double dValue;

    Node *pMyList=NULL;
    Node *pNewNode=NULL;

    printf("Welcome to the Linked List
    exercise.\n\n");
    printf("Enter the number of records
    you want to input ");
    scanf("%d",&iNum);
    printf("\nThanks. You entered %d\n\n",
    iNum);

    for (i=0; i<iNum; I++)
    (

    pNewNode=CreateNode(Name, dValue,
    20);
    InsertNode(&pMyList,pNewNode);
    )
    printf("Thank you.\n\n");
    printf("Here is your list:\n");
    ShowList(pMyList);

    return 0;
    )




    Node* CreateNode(char *eName, double dPrice,int iQuantity);
    (
    return NULL;
    )
    int InsertNode(Node **ppList, Node *pNode);
    (
    return 1;
    )
    int ShowList(Node*pList);
    (
    return 1;
    )
    int RemoveAll(Node **ppList);
    (
    return 1;
    )
    int DeleteFirst(Node **ppList,char *eName);
    (
    return 1;
    )
    int IncrementQuantity(Node *pList, char *eName,
    int iIncrement);
    (
    return 1;
    )
    int ShowCheaperProducts(Node *pList, double
    int dPrice);
    (
    return 1;
    )

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    How about you search for linked lists? No one is going to do your homework for you. Especially since it's been done a hundred times already here...

    Additionally, you have a bad habbit of using ( when you mean to use {. You'll want to correct that.

    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 10:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21