?? subsets.cpp
字號:
#include<iostream>
#define N 6
using namespace std;
int str[]={1,2,3,4,5,6}; //給定的一個集合
bool bo[N];
long xnum=0;
long NUM=64;
int power[64][N]={0};
int print(int);
void SetIntersection(int a[],int b[]);
void SetUnion(int a[],int b[]);
int main(int argc, char * argv[])
{
int i,j,t,m,n;
bool flag=true;
print(0);
//for(i=0;i<NUM;i++)
//{
// for(j=0;j<N;j++)
// cout<<power[i][j]<<" ";
//cout<<endl;
//}
for(m=0;m<NUM;m++)
for(i=0;i<N;i++)
{
// if (flag&&他們的并 集是全集)
if(flag) cout<<t<<" ";
}
return 0;
}
int print(int i)
{
if(i>=N)
{
int j,k=0;
++xnum;
/// cout<<"No."<<xnum<<'=';
//cout<<"{";
for(j=0; j<N; j++)
if(bo[j])
{
//if(k)
//cout<<',';
//cout<<str[j];
//++k;
power[xnum][j]=str[j];
}
//cout<<"}"<<endl;
return 0;
}
else
{
bo[i]=true;
print(i+1);
bo[i]=false;
print(i+1);
}
return 0;
}
void SetIntersection(int a[],int b[])
{
t=power[m][i];
for( n=0;n<NUM;n++)
for(j=0;j<N;j++)
if(t==power[n][j])
flag=false;
}
void SetUnion()
{
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -