fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n;
  6.  
  7. do
  8. {
  9. cin >> n;
  10. int matriz [n][n];
  11.  
  12. for (int i=0; i<n;i++)
  13. {
  14. for (int j=0; j<i;j++)
  15. {
  16. matriz[i][j] = i-j;
  17. }
  18. for (int j=i; j<n;j++)
  19. {
  20. matriz[i][j] = j-i;
  21. }
  22.  
  23. }
  24.  
  25. for (int i=0; i<n;i++)
  26. {
  27. for (int j=0; j<n-1;j++)
  28. cout << matriz[i][j]<<" ";
  29. cout << matriz[i][j]<<endl;
  30. }
  31. }while (n!= 0);
  32. return 0;
  33. }
Compilation error #stdin compilation error #stdout 0s 3144KB
stdin
1
2
3
4
5
0
compilation info
prog.cpp: In function 'int main()':
prog.cpp:29:22: error: name lookup of 'j' changed for ISO 'for' scoping [-fpermissive]
    cout << matriz[i][j]<<endl;
                      ^
prog.cpp:29:22: note: (if you use '-fpermissive' G++ will accept your code)
stdout
Standard output is empty