1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| #ifndef Matrice
#define Matrice
#include <iostream>
using namespace std;
class Matrice {
public:
Matrice(unsigned n = 0,unsigned m = 0):lig(n),col(m), data(new double[n*m]) {} ;
Matrice(const Matrice & M){
lig=M.lig;
col=M.col;
data=new double[lig*col];
for(int i=0;i<n*m;i++){
data[i]=M.data[i];
}
};
~Matrice(){delete[] data;};
double operator()(unsigned lig,unsigned col) const;
double& operator()(unsigned lig,unsigned col);
private:
unsigned lig,col;
double *data;
};
double Matrice::operator()(unsigned lig,unsigned col) const{
return data[lig*col];
};
double Matrice::operator()(unsigned lig,unsigned col){
return data[lig*col];
};
#endif |
Partager