思路:
最简单的方法, 五重循环输出每一位.
1 #include <iostream> 2 using namespace std; 3 4 int main() 5 { 6 ios::sync_with_stdio(false); 7 cin.tie(0); 8 9 for (int a = 0; a <= 1; a++) 10 for (int b = 0; b <= 1; b++) 11 for (int c = 0; c <= 1; c++) 12 for (int d = 0; d <= 1; d++) 13 for (int e = 0; e <= 1; e++) 14 cout << a << b << c << d << e << endl; 15 16 return 0; 17 }
原文:https://www.cnblogs.com/AntonLiu/p/12246795.html