میشه این برنامه رو روی ویژوال خود اجرا کنید
#include <iostream>
using namespace std;
int enter()
{
int a, i, j, b, A[20][20];
cout << "please enter satr & sotun\n";
cin >> a >> b;
cout << "****************************\nderaie ha ra vared konid\n";
for (j = 0; j < b; j++)
{
for (i = 0; i <a; i++)
cin >> A[i][j];
}
for (j = 0; j < b; j++)
{
cout << "\n\n";
{for (i = 0; i <a; i++)
cout << "\t" << A[i][j]; }
}
cout << "\n";
return 0;
}
/////////////////////////////////////////////////////
int sum()
{
int a, i, c, j, f, d, b, C[20][20], B[20][20], A[20][20];
cout << "please enter satr & sotun";
cin >> a >> b;
cout << "****************************\nderaie ha ra vared konid";
for (i = 1; i <= a; i++)
for (j = 1; j <= b; j++)
cin >> A[i][j];
cout << "****************************\nplease enter satr & sotun\t";
cin >> d >> f;
if (a == d, b == f)
{
cout << "\n****************************\n deraieh b ra vared konid\t";
for (i = 1; i <= d; i++)
for (j = 1; j <= f; j++)
cin >> B[i][j];
for (i = 1; i <= a; i++)
for (j = 1; j <= b; j++)
C[i][j] = A[i][j] + B[i][j];
for (i = 1; i <= d; i++)
for (j = 1; j <= f; j++)
cout << "\nsum matris\t" << i << j << "\t" << C[i][j] << "\t";
}

else
cout << "ghabel sum niste!!!!!\n";

return 0;

}
///////////////////////////////////////
int tafrigh()
{
int a, i, c, j, f, d, b, C[20][20], B[20][20], A[20][20];
cout << "please enter satr & sotun";
cin >> a >> b;
cout << "****************************\nderaie ha ra vared konid";
for (i = 1; i <= a; i++)
for (j = 1; j <= b; j++)
cin >> A[i][j];
cout << "****************************\nplease enter satr & sotun\t";
cin >> d >> f;
if (a == d, b == f)
{
cout << "\n****************************\n deraieh b ra vared konid\t";
for (i = 1; i <= d; i++)
for (j = 1; j <= f; j++)
cin >> B[i][j];
for (i = 1; i <= a; i++)
for (j = 1; j <= b; j++)
C[i][j] = A[i][j] - B[i][j];
for (i = 1; i <= d; i++)
for (j = 1; j <= f; j++)
cout << "\nsum matris\t" << i << j << "\t" << C[i][j] << "\t";
}

else
cout << "ghabel sum niste!!!!!\n";

return 0;
}
////////////////////////////////////////
int zarb()
{
int A[20][20], i, a, n, f, b, B[20][20], C[200][200], p, m, j;
cout << "please enter satr & sotun\n";
cin >> a >> b;
cout << "****************************\n deraie ha ra vared monid\n";
for (i = 1; i <= a; i++)
for (j = 1; j <= b; j++)
cin >> A[i][j];
cout << "please enter satr & sotun mat 2 ra\n";
cin >> f >> p;
cout << "****************************\n deraie ha ra vared monid\n";
for (m = 1; m <= f; m++)
for (n = 1; n <= p; n++)
cin >> B[m][n];

if (b == f)
{
for (n = 1; n <= p; n++)
for (i = 1; i <= a; i++)
{
for (m = 1; m <= f; m++)
{
C[i][n] += A[n][m] * B[m][i];
}
}
for (int y = 1; y <= a; y++)
{
cout << '\n';
for (int u = 1; u <= b; u++)
cout << C[u][y] << '\t';
}

}
else
cout << "\nnemishavad\n";
return 0;
}
///////////////////////////////////////

int taranahade()
{
int A[20][20], i, a, b, j;
cout << "please enter satr & sotun";
cin >> a >> b;
cout << "****************************\nderaie ha ra vared konid";
for (i = 1; i <= a; i++)
for (j = 1; j <= b; j++)
cin >> A[j][i];
cout << "\n";
for (i = a; i >= 1; i--)
for (j = b; j >= 1; j--)

cout << "\n*************************\ntaranahade " << i << j << "\t" << A[j][i] << "\n";

return 0;
}

////////////////////////////////////////
int max()
{
int a, i, c, d, j, f, b, C[20][20], temp, B[20][20], A[20][20];
cout << "please enter satr & sotun";
cin >> a >> b;
cout << "****************************\nderaie ha ra vared konid";
for (i = 1; i <= a; i++)
for (j = 1; j <= b; j++)
cin >> A[i][j];
temp = A[1][1];
for (i = 1; i <= a; i++)
for (j = 1; j <= b; j++)
{
if (temp < A[i][j])
temp = A[i][j];
}
cout << "\nMAX\t" << temp << "\n\n";
return 0;
}
/////////////////////////////////////
int min()
{
int a, i, c, j, f, b, temp, A[20][20];
cout << "please enter satr & sotun";
cin >> a >> b;
cout << "****************************\nderaie ha ra vared konid";
for (i = 1; i <= a; i++)
for (j = 1; j <= b; j++)
cin >> A[i][j];
temp = A[1][1];
for (i = 1; i <= a; i++)
for (j = 1; j <= b; j++)
{
if (temp > A[i][j])
temp = A[i][j];
}
cout << "\nMin\t" << temp << "\n\n";

return 0;
}
int minsatr()
{
int a, i, c, j, b, temp, B[20][20], A[20][20];
cout << "please enter satr & sotun";
cin >> a >> b;
cout << "****************************\nderaie ha ra vared konid";
for (i = 1; i <= a; i++)
for (j = 1; j <= b; j++)
cin >> A[i][j];
cout << "kodam satr ra mikhahid?";
cin >> i;
temp = A[1][1];

for (j = 1, i = i; j <= b; j++)
if (temp > A[i][j])
temp = A[i][j];

cout << "\nmin\t" << A[i][j];

return 0;
}
///////////////////////////////
#include <iostream>
#include <math.h>
using namespace std;
//read matrix
void inter(int a[100][100], int n)
{
int i, j;
for (i = 0; i<n; i++)
{
for (j = 0; j<n; j++)
{
cout << "enter row " << i << " column " << j << " :";
cin >> a[i][j];
}

}

}
// show matrix
void show(int a[100][100], int n)
{
int i, j;
for (i = 0; i<n; i++)
{
for (j = 0; j<n; j++)
{
cout << a[i][j] << " ";
}
cout << endl;
}
}
//---------------------------------------------------
//build new matrix:khad
void build(int b[100][100], int a[100][100], int i, int n)
{
int j, l;
int h = 0, k = 0;
for (l = 1; l<n; l++)
{
for (j = 0; j<n; j++)
{
if (j == i)
{
continue;
}
b[h][k] = a[l][j];
k++;
if (k == n - 1)
{
h++;
k = 0;
}

}
}
}
//--------------open-mind.ir--------------------------
//calculate determinte
int det(int a[100][100], int n)
{
int i, sum = 0;
int b[100][100];
if (n == 2)
{
sum = a[0][0] * a[1][1] - a[0][1] * a[1][0];
return sum;

}
else
{

for (i = 0; i<n; i++)
{
build(b, a, i, n);
sum += a[0][i] * pow(-1, i)*det(b, (n - 1));

}
}
return sum;
}

//-------------------------------------------
//main fuction and give lenght of matrix
/*int maain()
{
int n;
int a[100][100];

cout << "enter lenght of matrix:";
cin >> n;
cout << "\n--------------------------\n";
inter(a, n);
cout << "--------------------------\n";
show(a, n);
int d;
d = det(a, n);
cout << "--------------------------\n";
cout << "\n\n result: " << d;
cout << "\n\n=======================\n";
return 0;
} */
//////////////////////////////
int maxsatr()
{
int a, i, j, b, temp, A[20][20];
cout << "please enter satr & sotun";
cin >> a >> b;
cout << "****************************\nderaie ha ra vared konid";
for (i = 1; i <= a; i++)
for (j = 1; j <= b; j++)
cin >> A[i][j];
cout << "kodam satr ra mikhahid?";
cin >> i;
temp = A[1][1];

for (j = 1, i = i; j <= b; j++)
if (temp < A[i][j])
temp = A[i][j];
cout << "\nmax\t" << temp;

return 0;
}
///////////////////////////////////////////

int maxsotun()
{
int a, i, c, j, d, b, temp, A[20][20];
cout << "please enter satr & sotun";
cin >> a >> b;
cout << "****************************\nderaie ha ra vared konid";
for (i = 1; i <= a; i++)
for (j = 1; j <= b; j++)
cin >> A[i][j];
cout << "kodam sotun ra mikhahid?";
cin >> j;
temp = A[1][1];
for (j = j, i = 1; i <= a; i++)
if (temp < A[i][j])
temp = A[i][j];
cout << "\nmax\t" << temp;
return 0;
}
//////////////////////////
int minsotun()
{
int a, i, c, j, f, d, b, temp, A[20][20];
cout << "please enter satr & sotun";
cin >> a >> b;
cout << "****************************\nderaie ha ra vared konid";
for (i = 1; i <= a; i++)
for (j = 1; j <= b; j++)
cin >> A[i][j];
cout << "kodam sotun ra mikhahid?";
cin >> j;
temp = A[1][1];
for (j = j, i = 1; i <= a; i++)
if (temp > A[i][j])
temp = A[i][j];
cout << "\nmin\t" << temp;

return 0;
}


//////////////////////////////////
int replace()
{
int a, i, j, b, k, c, temp, A[20][20];
cout << "please enter satr & sotun\n";
cin >> a >> b;
cout << "****************************\nderaie ha ra vared konid\n";
for (j = 1; j <= b; j++)
{
for (i = 1; i <= a; i++)
cin >> A[i][j];
}
for (j = 1; j <= b; j++)
{
cout << "\n\n";
{for (i = 1; i <= a; i++)
cout << "\t" << A[i][j]; }
}
cout << "\n";

///////////////////////////////////////////////////////
cout << "kodam satr ra mikhahid ja be ja konid???\n";

cin >> c;
cin >> k;
cout << "khob hala";
for (i = 1; i <= a; i++)
{
temp = A[i][c];
A[i][c] = A[i][k];
A[i][k] = temp;
}
for (j = 1; j <= b; j++)
{
cout << "\n\n";
{for (i = 1; i <= a; i++)
cout << "\t" << A[i][j]; }
}
cout << "\n";

return 0;
}
/////////////////////////////////////////////
int zarbnoghte()
{
int A[20][20], i, a, n, f, b, B[20][20], C[200][200], p, m, j;
cout << "*** Z A R B N O G H T E H II ***\n\nplease enter satr & sotun\n";
cin >> a >> b;
cout << "****************************\n deraie ha ra vared monid\n";
for (i = 1; i <= a; i++)
for (j = 1; j <= b; j++)
cin >> A[i][j];
cout << "please enter satr & sotun mat 2 ra\n";
cin >> f >> p;
cout << "****************************\n deraie ha ra vared monid\n";
for (m = 1; m <= f; m++)
for (n = 1; n <= p; n++)
cin >> B[m][n];
if (a == f && b == p)
{
for (i = 1; i <= a; i++)
for (j = 1; j <= b; j++)
C[i][j] = A[i][j] * B[i][j];
for (i = 1; i <= a; i++)
for (j = 1; j <= b; j++)
cout << "zarb" << i << j << "\t" << C[i][j] << "\n";
}
else
cout << "zarb ne mishavad!!!!!!\n\n";

return 0;
}
///////////////////////////////
int balamos()
{
int a, i, c, d, j, b, A[20][20];
cout << "please enter satr & sotun\n\n";
cin >> a >> b;
cout << "deraie ha ra vared konid\n\n";
for (i = 0; i <a; i++)
for (j = 0; j < b; j++)
cin >> A[i][j];
d = 0, c = (a*a - (a*(a + 1) / 2));
cout << "tedad" << c << "\n\n";
if (a == b)
{
for (j = 0; j < a; j++)
for (i = 0; i < j; i++)
{
if (A[i][j] == 0)
d++;
}
if (d == c)
cout << "bala mosalasi ast!!!\n";
else
cout << "bala mosalasi nist!!!\n";
}

return 0;
}
/////////////////////////////
void paiinmos()
{
int a, i, c, d, j, b, A[20][20];
cout << "please enter satr & sotun\n";
cin >> a >> b;
cout << "deraie ha ra vared konid:\n";
for (i = 0; i <a; i++)
for (j = 0; j < b; j++)
cin >> A[i][j];
d = 0, c = (a*a - (a*(a + 1) / 2));
cout << "tedad" << c << "\n\n";
if (a == b)
{
for (i = 0; i < a; i++)
for (j = 0; i > j; j++)
{
if (A[i][j] == 0)
d++;
}
if (d == c)
cout << "paiin mosalasi ast!!!\n\n";
else
cout << "paiin mosalasi nist!!!\n\n";
}

return;
}

/////////////////////////////////
void ghotri()
{
int a, i, c, d, j, b, A[20][20];
cout << "please enter satr & sotun\n";
cin >> a >> b;
if (a == b)
{
cout << "deraie ha ra vared konid\n";
for (i = 0; i <a; i++)
for (j = 0; j < b; j++)
cin >> A[i][j];
d = 0, c = (a*a - (a*(a + 1) / 2));
if (a == b)
{
for (j = 0; j < a; j++)
for (i = 0; i < j; i++)
{
if (A[i][j] == 0)
d++;
}

if (a == b)
for (i = 0; i < a; i++)
for (j = 0; i > j; j++)
{
if (A[i][j] == 0)
d++;
}

if (d == c)
cout << " ghotri ast!!!\n";
else
cout << " gho tri nist!!!\n";
}
}
else
cout << "nemishe";

}
/////////////////////////////
int zinasbi(int **a, int x, int y, int i, int j)
{
bool max = true, min = true;
for (int k = 0; k < y; k++)
{
if (a[i][k] < a[i][j])
{
min = false;
return 0;
}
}
for (int k = 0; k < x; k++){
if (a[k][j] > a[i][j])
{
max = false;
return 0;
}
}
return 1;
}
////
void maain()
{
int **a;
int i, j;
bool f = true;
int n, m;
cout << "\nlotfan satr matris ra vared konid\n";
cin >> n;
cout << "\nlotfan sotoun matris ra vared konid\n";
cin >> m;
a = new int *[n];
for (i = 0; i < m; i++)
{
a[i] = new int[i];
}
for (i = 0; i<n; i++)
{
for (j = 0; j<m; j++)
{
cout << "\t [ " << i + 1 << " , " << j + 1 << " ] = ";
cin >> a[i][j];
}
}
cout << "\n\n\n";
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++)
{
if (zinasbi(a, n, m, i, j) == 1)
{
cout << "a[" << i << "][" << j << "]=" << a[i][j] << endl;
f = false;
}
}
}
if (f)
{
cout << "noghte zin asbi dar in matris vojoud nadarad.\n";
}
return ;
}
////////////////////////////////
void main()
{
int l;
cout << "\n\t\t\t***** M E N U****\n\n Adad mored nazar khod ra vared konid\n 1 sum\n\n 2 tafrigh \n\n 3 zarb \n\n 4 max \n\n 5 min \n\n 6 minsatr\n\n 7 maxsatr \n\n 8 maxsotun \n\n 9 minsotun\n\n 10 replace \n\n 11 paiinmos \n\n 12 balamos\n\n 13 ghotri \n\n 14 zarbnoghte\n\n 15 taranahade \n\n 16 zinasbi\n\n 17 det\n ";
cin >> l;
switch (l)
{
case 1:

int sum();
break;

case 2:

int tafrigh(); break;

case 3:

int zarb(); break;

case 4:

int max(); break;
case 5:

int min(); break;

case 6:
int minsatr();
break;

case 7:

int maxsatr(); break;

case 8:

int maxsotun(); break;

case 9:

int minsotun(); break;

case 10:

int replace(); break;

case 11:

void paiinmos();
break;

case 12:

int balamos(); break;

case 13:

void ghotri();
break;

case 14:

int zarbnoghte(); break;

case 15:

int taranahade();
break;

case 16:

int zinasbi(); break;

case 17:

int det(); break;
}
cout << "gozine vared shode dorost nist";

return ;
}