#include <iostream>using namespace std; int main() { int n; do { cin >> n; int matriz [n][n]; for (int i=0; i<n;i++) { for (int j=0; j<i;j++) { matriz[i][j] = i-j; } for (int j=i; j<n;j++) { matriz[i][j] = j-i; } } for (int i=0; i<n;i++) { for (int j=0; j<n-1;j++) cout << matriz[i][j]<<" "; cout << matriz[i][j]<<endl; } }while (n!= 0); return 0;}
1 2 3 4 5 0
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)
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!