+ 2

Can anyone help me?

#include<bits/stdc++.h> using namespace std; int main() { int n; cout<<"n="; cin>>n; int **a = new int *[n]; for(int i = 1; i <= n; i++) { a[i] = new int[n+1]; for(int i = 1; i <= n; i++) { for(int j = 1; j <= n; j++) { cin>>a[i][j]; } } } int **b = new int *[n+1]; for(int i = 1; i <= n; i++) { b[i] = new int[n+1]; for(int i = 1; i <= n; i++) { for(int j = 1; j<=n; j++){ cin>>b[i][j]; } } } int **w = new int *[n+1]; for(int i = 1; i <= n; i++){ w[i] = new int[2*n+1]; for(int i = 1; i <= n; i++){ for(int j = 1; j <= n; j++) { w[i][j] = a[i][j]; } } } for(int i = 1; i <= n; i++){ for(int j = n+1; j <= 2*n; j++){ w[i][j] = b[i][j-n]; } } for(int i = 1; i <= n; i++){ for(int j = 1; j <= 2*n; j++){ cout<<w[i][j]<<" "; } cout<<endl; } }

3rd Mar 2020, 2:48 PM
Diyorbek Olimov
Diyorbek Olimov - avatar
3 ответов
+ 1
We are given two n x n matrices. Create a matrix n x 2n by connecting the matrices sequentially. Solve the problem through a dynamic array.
3rd Mar 2020, 3:49 PM
Diyorbek Olimov
Diyorbek Olimov - avatar