View Single Post
  #5 (permalink)  
Old 02-26-2008, 11:24 AM
WingedPanther's Avatar   
WingedPanther WingedPanther is offline
Super Moderator
 
Join Date: Jul 2006
Age: 35
Posts: 2,057
Last Blog:
wxWidgets is NOT code ...
Rep Power: 24
WingedPanther is a jewel in the roughWingedPanther is a jewel in the roughWingedPanther is a jewel in the roughWingedPanther is a jewel in the rough
Default

One way to approach it:
Have a for loop from 0 to 2^digits -1.
For each value, do a bitwise and against 1,2,4,8,etc, counting the number of results that are 1. Sum the results (to count the number of 1's) and also concatenate the IntToStrings of the results(to build a string to display). If the sum is 2, then print the string.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall
Reply With Quote

Sponsored Links