2.1 (C++)

Design a class Matrix that has the following private member variables:
int rows
int columns
double * values
Besides, it has the following public functions:
A constructor Matrix(int rows, int column), which initializes all elements in the matrix to all 0's.
A destructor.
A print function which prints each row of elements in a single line, with each element preceded with 4 spaces.
EXAMPLE INPUT
4 5
EXAMPLE OUTPUT

0    0    0    0    0
0    0    0    0    0
0    0    0    0    0
0    0    0    0    0

主程序 (不能修改)

#include "source.cpp"

int main() {
    int rows;
    int columns;
    cin >> rows >> columns;
    Matrix matrix1(rows, columns);
    matrix1.print();
}

我的答案

上一篇: 2.2 (C++) 下一篇: 1.2 (C++)
支持 makedown语法