fork download
  1. #include <iostream>
  2.  
  3. void foo_rec(int i, int k, int t, int p)
  4. {
  5. std::cout << i << k << t << p << std::endl;
  6. if (++p == 2) {
  7. p = 0;
  8. if (++t == 2) {
  9. t = 0;
  10. if (++k == 2) {
  11. k = 0;
  12. ++i;
  13. }
  14. }
  15. }
  16. if (i < 2) {
  17. foo_rec(i, k, t, p);
  18. }
  19. }
  20.  
  21. void foo()
  22. {
  23. foo_rec(0, 0, 0, 0);
  24. }
  25.  
  26.  
  27. int main() {
  28. foo();
  29. }
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111