#include"wz.h"
int cheack(int a[],int n)
{
int star=a[0];int c=0;
for(i=1;i<n;i++)
{
if(a[i]>star){k++;c++;}
if(a[i]==star-1){k++;star=a[i];}
}
if(k==n-1&&c!=n-1) return 1;
else return 0;
}
// cout<<"it is not"<<endl;
int m()
{
int l=0;
int a[]={1,4,2,3};
cout<<cheack(a,4)<<endl;
count=0;
for(i=1;i<4;i++)
{
for(j=1;j<4;j++)
{
for(k=1;k<4;k++)
{
//cout<<k<<" "; count++;
if(i!=j&&j!=k&&k!=l&&k!=i)
{ a[0]=i; a[1]=j; a[2]=k;
cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<""<<endl;
if(cheack(a,3))count++;
}
}
}
}
cout<<count<<endl;
return 0;
}
int* get(int k,int a[])
{int j=0;
while(k)
{
a[j]=k%2;
k=k/2;
j++;
}
return a;
}
void gelei(int n)
{ int j=0; int a[10]={0};
for(i=0;i<=n;i++)
{cout<<i<<":";
get(i,a);
for(j=9;j>=0;j--)
cout<<a[j];
cout<<endl;
/**** to be gelei start *******/
for(j=0;j<9;j++)
a[j]^=a[j+1];
/**** to be gelei end*******/
cout<<" ";
for(j=9;j>=0;j--)
cout<<a[j];
cout<<endl;
}
}
int main()
{
int n=5;
gelei(n);
return 0;
}//wz.h放了一些函数 和定义了 i,j,k等
[wz@bogon ~]$ g++ zy.cpp
[wz@bogon ~]$ ./a.out
0:0000000000
0000000000
1:0000000001
0000000001
2:0000000010
0000000011
3:0000000011
0000000010
4:0000000100
0000000110
5:0000000101
0000000111
















