问题描述
对于长度为6位的一个01串,每一位都可能是0或1,一共有64种可能。它的前几个是:
000000
000001
000010
000011
000100
请按从小到大的顺序输出这64种01串。
000000
000001
000010
000011
000100
请按从小到大的顺序输出这64种01串。
输出格式
输出64行,每行一个01串。
源代码
- #include<iostream>
- #include<bitset>
- using namespace std;
- int main()
- {
- int i;
- for (i = 0; i < 64;i++)
- cout << bitset<6>(i)<<endl;
- return 0;
- }