#include<iostream>
using namespace std;
double NUMB_COLS = 3;
void readMatrix(int matr[] [3], int numb_rows, int numb_cols)
{
for (int i = 0; i<numb_rows; i++)
{
for (int j = 0; j < numb_cols; j++)
{
cout <<"[" << i << "] [" <<j <<"] =";
cin >> matr[i][j];
}
}
}
void printMatr(int matr[][3], int numb_rows, int numb_cols)
{
for (int i = 0; i < numb_rows; i++)
{
for (int j = 0; j < numb_cols; j++)
{
cout << "[" << i << "][" << j << "] = " << matr[i][j];
}
cout << endl;
}
}
int main()
{
int matr[5][10];
printMatr(matr, 4, 5);
readMatrix(matr, 4, 5);
return 0;
}
該錯誤是二維陣列誤差
31 23 C:\ Users \用戶的Windows \桌面\程序\ arrays2.cpp [錯誤]不能轉換 'INT()[10]' 至'INT()[3]' 的參數 '1' 到 '空隙readMatrix(INT(*)[3],INT,INT)'
做什麼?
使用'std :: vector'。 –