series of combinations

HI I have a series(sorted), which i require to create combinations. I am not getting the good code for doing this. My series should generate the following combinations... Please help me in getting this in C++. Thanks for your help.

A:
A
A B:
A
B
A B

A B C:
A
B
C
AB
AC
BC
ABC

A B C D:
A
B
C
D
AB
AC
AD
BC
BD
CD
ABC
ABD
ACD
BCD
ABCD

A B C D E:
A
B
C
D
E
AB
AC
AD
AE
BC
BD
BE
CD
CE
DE
ABC
ABD
ABE
ACD
ACE
ADE
BCD
BCE
BDE
CDE
ABCDE
and so on....

I found many sources when googling for a description of your problem:
permutations and combinations c++ - Google
Also check google codesearch with such programs in the public domain, it has helped me well in the past.