fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int len = 10;
  7. bool* array = new bool[len];
  8.  
  9. for (int i = 0; i < 50; ++i)
  10. {
  11. for (int i = len - 1; i >= 0; --i)
  12. {
  13. if ( ! array[i])
  14. {
  15. array[i] = true;
  16. break;
  17. }
  18. array[i] = false;
  19. }
  20.  
  21. /// printing
  22. for (int i = 0; i < 10; ++i)
  23. {
  24. cout << (array[i] ? 1 : 0) << "|";
  25. }
  26. cout << endl;
  27. ///
  28. }
  29. return 0;
  30. }
Success #stdin #stdout 0s 3272KB
stdin
Standard input is empty
stdout
0|0|0|0|0|0|0|0|0|1|
0|0|0|0|0|0|0|0|1|0|
0|0|0|0|0|0|0|0|1|1|
0|0|0|0|0|0|0|1|0|0|
0|0|0|0|0|0|0|1|0|1|
0|0|0|0|0|0|0|1|1|0|
0|0|0|0|0|0|0|1|1|1|
0|0|0|0|0|0|1|0|0|0|
0|0|0|0|0|0|1|0|0|1|
0|0|0|0|0|0|1|0|1|0|
0|0|0|0|0|0|1|0|1|1|
0|0|0|0|0|0|1|1|0|0|
0|0|0|0|0|0|1|1|0|1|
0|0|0|0|0|0|1|1|1|0|
0|0|0|0|0|0|1|1|1|1|
0|0|0|0|0|1|0|0|0|0|
0|0|0|0|0|1|0|0|0|1|
0|0|0|0|0|1|0|0|1|0|
0|0|0|0|0|1|0|0|1|1|
0|0|0|0|0|1|0|1|0|0|
0|0|0|0|0|1|0|1|0|1|
0|0|0|0|0|1|0|1|1|0|
0|0|0|0|0|1|0|1|1|1|
0|0|0|0|0|1|1|0|0|0|
0|0|0|0|0|1|1|0|0|1|
0|0|0|0|0|1|1|0|1|0|
0|0|0|0|0|1|1|0|1|1|
0|0|0|0|0|1|1|1|0|0|
0|0|0|0|0|1|1|1|0|1|
0|0|0|0|0|1|1|1|1|0|
0|0|0|0|0|1|1|1|1|1|
0|0|0|0|1|0|0|0|0|0|
0|0|0|0|1|0|0|0|0|1|
0|0|0|0|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