Main.cc: In function 'int main()': Main.cc:21:20: error: 'n' was not declared in this scope for(int k=1;k<=2*n-2*i-1;k++){ ^