| Task: | Ratsun reitit |
| Sender: | Kemil |
| Submission time: | 2020-10-01 13:28:36 +0300 |
| Language: | C++ (C++17) |
| Status: | COMPILE ERROR |
Compiler report
input/code.cpp:1:10: error: #include expects "FILENAME" or <FILENAME>
#include iostream
^~~~~~~~
input/code.cpp: In function 'int main()':
input/code.cpp:6:2: error: 'cin' was not declared in this scope
cin n;
^~~
input/code.cpp:6:2: note: suggested alternative: 'main'
cin n;
^~~
main
input/code.cpp:24:22: error: expected ';' before numeric constant
for (int i = 0; i 4; i++)
^
input/code.cpp:24:22: warning: for increment expression has no effect [-Wunused-value]
input/code.cpp:24:23: error: expected ')' before ';' token
for (int i = 0; i 4; i++)
^
input/code.cpp:24:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
for (int i = 0; i 4; i++)
^~~
input/code.cpp:24:25: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
for (int i = 0; i 4; i++)
^
input/code.cpp:24:25: error: 'i' was not declared in t...Code
#include iostream
using namespace std;
int main()
{
int n;
cin n;
int Grid[100][100];
int Base[5][5] =
{
{0,3,2,3,2},
{3,4,1,2,3},
{2,1,4,3,2},
{3,2,3,2,3},
{2,3,2,3,4}
};
if (n == 4)
{
int Case4[4][4] = {
{0, 3, 2, 5},
{3, 4, 1, 2},
{2, 1, 4, 3},
{5, 2, 3, 2}
};
for (int i = 0; i 4; i++)
{
for (int j = 0; j 4; j++)
{
cout Case4[i][j];
}
cout endl;
}
}
else
{
for (int j = 0; j 5; j++)
{
for (int k = 0; k 5; k++)
{
Grid[j][k] = Base[j][k];
}
}
for (int y = 5; y n; y++)
{
Grid[y][0] = Grid[y - 2][1] + 1;
Grid[0][y] = Grid[1][y - 2] + 1;
for (int x = 1; x = y; x++)
{
Grid[y][x] = Grid[y - 2][x - 1] + 1;
Grid[x][y] = Grid[y - 2][x - 1] + 1;
}
}
for (int i = 0; i n; i++)
{
for (int j = 0; j n; j++)
{
cout Grid[i][j];
}
cout endl;
}
}
}