include iostream int main this is the test variant of the matrix int m

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <iostream.h>
int main()
{
//this is the test variant of the matrix
int matrix[ 5 ][ 6 ] = {{1,2,3,4,5,6},{1,2,3,4,5,6},{1,2,3,4,5,6},{1,2,3,4,5,6},{1,2,3,4,5,6}};
int newMatrix[ 5 ][ 5 ];
int k, s, i;
cout << "Input the number, which will be deleted: ";
cin >> k;
k++;
cout << "From the first matrix: " << endl;
for ( i = 0; i < 5; i++ ) {
for ( int j = 0; j < 6; j++ )
cout << matrix[ i ][ j ] << " ";
cout << endl;
}
cout << "Delete this column " << k-1 << endl;
for ( i = 0; i < 5; i++ )
for ( int j = 0; j < 6; j++ ) {
s = j;
if ( j + 1 >= k ) s -= 1;
newMatrix[ i ][ s ] = matrix[ i ][ j ];
}
cout << "Final: " << endl;
for ( i = 0; i < 5; i++ ) {
for ( int j = 0; j < 5; j++ )
cout << newMatrix[ i ][ j ] << " ";
cout << endl;
}
return 0;
}