how to generate a code like this

Discussion in 'C' started by atoivan, Nov 6, 2011.

  1. atoivan

    atoivan New Member

    Joined:
    Nov 6, 2011
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Home Page:
    http://greensunset-sys.blogspot.com/
    i am writing a database program and i want to generate item codes so that all the item will be identified by this code.

    the items are in categories examples (soft-drinks,wines beers ....etc )

    i want to crate a function the will generate this codes for me. example a category (Array) is wines all the item codes in Wine in the Array Wine should begin with the word 'W' if it is Beers all the items codes in the Array Beer must begin with' B'.

    thank u
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    Code:
    char generate_code(char *category)
    {
      return category[0];
    }
    
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice