Refer http://www.codeproject.com/cpp/CombC.asp