36 lines
1.1 KiB
C++
36 lines
1.1 KiB
C++
#include <iostream>
|
|
#include "matrix.h"
|
|
using namespace std;
|
|
/*
|
|
TO TEST:
|
|
ok matrix(int rows = 0, int cols = 0);
|
|
ok ~matrix() { delete[] element; }
|
|
ok int rowss() const { return rows; }
|
|
ok int columns() const { return cols; }
|
|
ok int times(int i, int j, matrix<T>& left, matrix<T>& right) const;//If unused, write it in private
|
|
T& operator()(int i, int j) const;
|
|
matrix<T>& operator=(const matrix<T>& x);
|
|
//matrix<T> operator+() const;
|
|
matrix<T> operator+(const matrix<T>& x) const;
|
|
//matrix<T> operator-() const;
|
|
matrix<T> operator-(const matrix<T>& x) const;
|
|
matrix<T> operator*(const matrix<T>& x) const;
|
|
matrix<T>& operator+=(const matrix<T>& x);
|
|
friend ostream& operator<<(const matrix<T>& x);
|
|
*/
|
|
|
|
int main() {
|
|
int l[] = { 1,2,3,4,5,6 };
|
|
matrix<int> left(2, 3, l), right(3, 2, l);
|
|
cout << "left: " << endl << left << endl;
|
|
cout << "right: " << endl << right << endl;
|
|
|
|
cout << "left(1, 1): " << left(1, 1) << endl;
|
|
cout << "right(2, 1): " << right(2, 1) << endl << endl;
|
|
|
|
int out[] = { 1,2,3,4 };
|
|
matrix<int> tmp(2, 2, out);
|
|
tmp = left * right;
|
|
cout << "times: " << endl << tmp << endl;
|
|
return 0;
|
|
} |