C/C++

Программисты, нужна помощь

// main.cpp
#include <iostream>

using namespace std;

extern int ** create(const int x);
extern void insert(int ** A, const int x);

void print(int ** A,const int x)
{
for(int i = 0; i < x; i++)
{
for(int j = 0; j < x; j++)
cout << A[i][j] << '\t';
cout << endl;
}
cout << endl;
}

int main()
{
int x;
cin >> x;
int ** A;
A = create(x);
insert(A,x);
print(A,x);
if(A != (int**) nullptr)
{
for(int i = 0; i < x; i++)
{
if(A[i] != (int*) nullptr)
{
delete [] A[i];
A[i] = (int*) nullptr;
}
else return 1;
}
delete [] A;
A = (int**) nullptr;
return 0;
}
return 1;
}

// module2.cpp
int ** create(const int x)
{
int ** A;
A = new int*[x];
for(int i = 0; i < x; i++)
A[i] = new int[x];
for(int i = 0; i < x; i++)
for(int j = 0; j < x; j++)
A[i][j] = 0;
return A;
}

// module3.cpp
void insert(int ** A, const int x)
{
for(int i = 0; i < x; i++)
{
for(int j = 0; j < x; j++)
{
if(i == x - 1 - j) A[i][j] = 1;
else if(i < x - 1 - j) A[i][j] = 0;
else A[i][j] = 2;
}
}
}
=B
= Bezbashenny =
78 203
Лучший ответ