Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   how to generate a code like this (http://www.go4expert.com/forums/generate-code-t27098/)

atoivan 6Nov2011 19:37

how to generate a code like this
 
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

xpi0t0s 7Nov2011 20:00

Re: how to generate a code like this
 
Code:

char generate_code(char *category)
{
  return category[0];
}



All times are GMT +5.5. The time now is 00:49.