i wished to write a code in **c or c++** that could help me to generate numbers containing only two type of digits(say 0,1) till an appropriate limit (say 100000).eg.0,1,01,00,10,11,110,111,101…and so on…

without traversing from 0 to the actual range (by comparing the individual digits if they are 0 and 1).

use rand()%2 to generate 0 or 1.