fork download
  1. #include <iostream>
  2.  
  3. int main()
  4. {
  5. for( int outer = 0 ; outer < 3 ; ++outer )
  6. {
  7. std::cout << "outer: " << outer << '\n' ;
  8.  
  9. for( int inner = 0 ; inner < 5 ; ++inner )
  10. {
  11. std::cout << " inner: " << inner << " (outer:" << outer << ")\n" ;
  12. }
  13.  
  14. std::cout << '\n';
  15. }
  16. }
  17.  
Success #stdin #stdout 0s 2896KB
stdin
Standard input is empty
stdout
outer: 0
    inner: 0 (outer:0)
    inner: 1 (outer:0)
    inner: 2 (outer:0)
    inner: 3 (outer:0)
    inner: 4 (outer:0)

outer: 1
    inner: 0 (outer:1)
    inner: 1 (outer:1)
    inner: 2 (outer:1)
    inner: 3 (outer:1)
    inner: 4 (outer:1)

outer: 2
    inner: 0 (outer:2)
    inner: 1 (outer:2)
    inner: 2 (outer:2)
    inner: 3 (outer:2)
    inner: 4 (outer:2)