Files
School/Anul 1/Semestrul 2/Data structures/Lab 1/Matrix/Matrix.h
T
2024-08-31 12:07:21 +03:00

40 lines
804 B
C++

#pragma once
//DO NOT CHANGE THIS PART
typedef int TElem;
#define NULL_TELEM 0
class Matrix {
private:
//TODO - Representation
TElem* values;
int* lines;
int* columns;
int numberOfLines;
int numberOfColumns;
public:
//constructor
Matrix(int nrLines, int nrCols);
//returns the number of lines
int nrLines() const;
//returns the number of columns
int nrColumns() const;
//returns the element from line i and column j (indexing starts from 0)
//throws exception if (i,j) is not a valid position in the Matrix
TElem element(int i, int j) const;
//modifies the value from line i and column j
//returns the previous value from the position
//throws exception if (i,j) is not a valid position in the Matrix
TElem modify(int i, int j, TElem e);
void setMainDiagonal(TElem e);
};