Well, now I'm on assignment 2 and am once again flustered. This time around, we have to use a class to dynamically allocate a 2D Matrix and later integrate it into the previous assignment (My last topic with the 1st assignment)

Anyway, here's what I have so far.

Yeah, you all know my real name now since I'm too lazy to go back and delete it.Code:// main.cpp // Donald Parker // 09/16/2003 // main.cpp // Donald Parker // 09/16/2003 #include <iostream> #include "matrix.h" using namespace std; #define ROWS = 5 #define COLS = 10 int main() { Matrix table(3,4); Type k = 0; for(int i=0;i<3;i++) for(int j=0;j<4;j++) { table.set(i,j,k++); cout<<table.get(i,j); } return 0; } // matrix.cpp // Donald Parker // 09/16/2003 #include "matrix.h" Matrix::Matrix() { Type *array; _rows = ROWS; _cols = COLS; array = new Type[ROWS*COLS]; } Matrix::Matrix(int rows, int cols) { Type *array; _rows = rows; _cols = cols; array = new Type[rows*cols]; } Matrix::~Matrix() { } void Matrix::set(int row, int column, Type symbol) { array[row*_rows+column] = symbol; } Type Matrix::get(int row, int column) { return array[row*_rows+column]; } // matrix.h // Donald Parker // 09/16/2003 #include <iostream> using namespace std; const int ROWS = 5; const int COLS = 10; #define Type char class Matrix{ public: Matrix(); ~Matrix(); Matrix(int,int); void set(int,int,Type); Type get(int,int); private: Type array[ROWS*COLS]; int _rows; int _cols; };

So what can I do.

This time, I won't be back on until later tonight, so I can't discuss more throughly until then.

Edit: Sorry for the unclear message title before. You can delete this post, and I'll make a clearer one tomorrow.