Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- const int n = 20;
- bool increment(bool* a) {
- for (int i = 0; i < n; i++) {
- a[i] = not a[i];
- if (a[i]) return false;
- }
- return true;
- }
- void disp(bool* a) {
- for (int i = 0; i < n; i++) cout << a[i];
- cout << endl;
- }
- int main() {
- bool list[n];
- for (int i = 0; i < n; i++) list[i] = 0;
- disp(list);
- while (not increment(list)) disp(list);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement