Netwars

C++

[#1]
24.10.2007 21:54

class SquareMatrix {
private:
// here go declarations of class attributes...
// ...
public:
SquareMatrix(double ** array, int dim)
throw(IllegalArgumentException);
SquareMatrix inverse() const
throw(DeterminantZeroException);
double determinant() const;
SquareMatrix operator +(const SquareMatrix & matrix) const
throw(DimensionsNotEqualException);
SquareMatrix operator *(const SquareMatrix & matrix) const
throw(DimensionsNotEqualException);
SquareMatrix operator *(double coeff) const;
friend SquareMatrix operator *(double coeff, const SquareMatrix & matrix);
bool operator ==(const SquareMatrix &) const
throw(DimensionsNotEqualException);
friend ostream & operator <<(ostream & out, SquareMatrix & matrix);
};

Czy mogby mi ktos pokazac jak zaimplementowac funckje:

SquareMatrix operator +(const SquareMatrix & matrix) const
throw(DimensionsNotEqualException);

Ma to byc przeciążony operator dodawania, który ma mi dodawac 2 macierze :). Reszte przeciazen sam zrobie :)
Z góry dzieki.

[#2]
24.10.2007 21:54

alve miala nawet B+ OoO

[#4]
24.10.2007 22:18

Wisdom. Podal bys atrybuty, to mozna by sie zajac metodami...

[#5]
25.10.2007 00:21

atrybut:
int n; // wymiar macierzy

[#6]
25.10.2007 00:22

no sry, a gdzie przechowujesz liczby nalezace do macierzy ?

[#7]
25.10.2007 01:12

taa jeszcze macierz, powiedzmy float mac[n][n];

[#8]
25.10.2007 03:47

No ja bym proponowal jeszcze zamienic na float** mac; i mozna by to zaczac implementowac, ale pozno juz wiec moze jutro.

Zaloguj się, żeby odpowiedzieć.