The user input a matrix, and the output must be a new matrix with an additional column of zeros. If we apply the script to a 2 square matrix like : {1,2,3,4}
the new matrix output will be a 2 rows & 3 columns : {1,2,32,3,4,0}. I don't understand the number 32 output.
#include <iostream>
int main(){
int m,n;
std::cout << "Input the size of the square matrix : ";
std::cin >> m;
n=m;
int A[m][n]={};
int M[m][n+1]={0};
for (int i(0);i<m;i++){
for(int j(0);j<n;j++){
std::cout << "Input element A["<<i<<"]["<<j<<"] : ";
std::cin >> A[i][j];
M[i][j]=A[i][j];
}
}
for (int i(0);i<m;i++){
for(int j(0);j<=n;j++){
std::cout << M[i][j] << " ";
}
std::cout << "\n";
}
return 0;
}