小编use*_*544的帖子

'int'的问题

我是编程的新手,所以我想写一个代码,让我输入一个二维数组(或我的情况下的矩阵),然后打印它.

#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)

c++ arrays user-input multidimensional-array

2
推荐指数
1
解决办法
250
查看次数

标签 统计

arrays ×1

c++ ×1

multidimensional-array ×1

user-input ×1