lkml.org 
[lkml]   [2020]   [Jul]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subjectnew binary algorithm
Date
hey,


for those who read my email, i upgraded tjhe algorithm

here it is

#include <stdio.h>


 // The algorithm works by first getting a base of 0000, and change one
bit at a time (0001,0010,etc);
// Then it uess a base of 1111 and change one bit at a time
(1110,1101,etc...)


int main() {
    char zeros[] = { '0','0','0','0','0','0','\0'};
                 char ones[] = { '1','1','1','1','1','1','\0'};

                 printf("\n%s",zeros);

                 int iterator;

                 for (iterator=0 ; iterator < (sizeof(zeros)-1) ;
iterator++) {
                    zeros[iterator] = '1';
                    printf("\n%s",zeros);
                    zeros[iterator] = '0';
                }
                 printf("\n%s",ones);

                 for (iterator=0 ; iterator < (sizeof(ones)-1);
iterator++) {
                        ones[iterator] = '0';
                        printf("\n%s",ones);
                        ones[iterator] = '1';
                    }
}

\
 
 \ /
  Last update: 2020-07-06 04:01    [W:0.031 / U:0.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site