online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <iostream> using namespace std; int main() { int n, m = 1; cin >> n; int a[n][n]; if(n % 2 != 0){ a[(n / 2)][(n / 2)] = (n * n); } for(int i = 0; i < (n / 2); i++){ ////////////////// 1 такт ///////////// for(int j = i; j < (n - i); j++){ a[i][j] = m; m++; } //////////////////////////////////////// //////////////////// 2 такт ///////////// for(int j = 1; j < (n - i - i); j++){ a[(j + i)][(n - i) - 1] = m; m++; } /////////////////////////////////////////// ////////////////////// 3 такт ///////////// for(int j = (n - 2) - i; j >= i; j--){ a[(n - i) - 1][(j)] = m; m++; } ////////////////////////////////////////////// //////////////////// 4 такт //////////////////// for(int j = ((n - i) - 2); j > i; j--){ a[j][i] = m; m++; } /////////////////////////////////////////////// } for(int i = 0; i < n; i++){ for(int j = 0; j < n - 1; j++){ cout << a[i][j] << " " ; } cout << a[i][n - 1] << endl; } return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue