21.01.2008, 17:54
общий
это ответ
Здравствуйте, Razum89!
#include<iostream>
#include<conio.h>
#include<time.h>
using namespace std;
void main () {
int m,i,j;
srand (unsigned int (time (NULL)));
cout << "Enter M: ";
cin >> m;
int **b = new int *[m];
for (i=0; i<m; i++) {
b[i] = new int [m];
for (j=0; j<m; j++)
b[i][j] = rand() % 10;
}
cout << endl;
for (i=0; i<m; i++){
for (j=0; j<m; j++)
cout << b[i][j] << " ";
cout << endl;
}
for (i=0; i<m-1; i++)
for (j=0; j<m-i-1; j++)
b[i][j] = 0;
cout << endl;
for (i=0; i<m; i++){
for (j=0; j<m; j++)
cout << b[i][j] << " ";
cout << endl;
}
getch();
}