我是编程的新手,所以我想写一个代码,让我输入一个二维数组(或我的情况下的矩阵),然后打印它.
#include <iostream>
using namespace std;
void printArray( const int *array, int count )
{
for ( int i = 0; i < count; i++ )
cout << array[ i ] << " ";
cout << endl;
}
int main () {
int n;
cout<<"Please enter the length of your matrix : "<<endl;
cin>>n;
int * y=new int [n];
for (int w = 0; w <= n-1; w++ ) {
y[w] = new int [n];
cout<<"Insert the elements ";
for …Run Code Online (Sandbox Code Playgroud)