thank you for your replies,
tabstop your idea was great thank you. I tried to make a code that makes that binairy odometer, it works partly, because after the 5 digits it gives rubbish information. The problem is that he has to go up to 32000000 digits. Is it possible with this program structure, if not could someone tell me how it has to be done? thank you in advance.
here is the code:
Code:
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
long getal;
cin>>getal;
double kopie=getal;
long hoi=pow(2,kopie);
cout<<hoi<<endl;
bool tabel[getal][hoi];
for(int n=0;n<=hoi;n++)
{
for(int t=0;t<=getal;t++)
{
tabel[t][n]=false;
}
}
for(int n=0;n<=(hoi);n++)
{
if (n==0)
{n++;}
for(int t=0;t<=getal;t++)
{
tabel[t][n]=tabel[t][n-1];
}
for(int ok=0, h=0;ok==0;)
{
if (tabel[h][n]==false)
{tabel[h][n]=true;ok=1;}
else
{
tabel[h][n]=false;
h++;
}
}
}
for(int n=0;n<=hoi;n++)
{
for(int t=0;t<=(getal-1);t++)
{
if(tabel[t][n]==true)
{cout<<1;}
else
{cout<<0;}
}
cout<<endl;
}
char stop;
cin>>stop;
return(0);
}
sorry for the big main but I am not that good in programming and I hadn't that much time to put everything in functions