All pastes #265995 Raw Edit

Anonyme

public text v1 · immutable
·published 2006-12-03 20:38 UTC
rendered paste body
//ENTETE.H
class Matrice3x3
{
 long **tableau;
 long DimX, DimY;
 
 public:
 Matrice3x3();
 Matrice3x3(const long & DimX, const long & DimY);
 ~Matrice3x3();
 bool Lecture(const long & BoiteX, const long & BoiteY, long & Resultat);
 bool Ecriture(const long & BoiteX, const long & BoiteY, const long & Valeur);
 bool Extraction(const long & Axe, const long & Indice, long *TabExctract);
};

//CONSTRUCTEUR.CPP
Matrice3x3 :: Matrice3x3()
{

}

Matrice3x3 :: Matrice3x3(const long & TailleX, const long & TailleY)
{
 tableau = new long* [DimX];
 
 fill_n( tableau, TailleX, static_cast<long*>( 0 ) );
 
 
 int cpt2;
 for(int cpt = 0 ; cpt < TailleX ; cpt++)
   {
   tableau[cpt] = new long[TailleY];
   
   for(cpt2 = 0 ; cpt2 < TailleY ; cpt2++)
     tableau[cpt][cpt2] = 0;
   }
}


//MAIN.CPP
Matrice3x3 *Tableau3d;

cout << "Profondeur du tableau ? " << endl;
int profondeur;
cin >> profondeur;

Tableau3d = new Matrice3x3[profondeur];

bool resultat;
resultat = Tableau3d[0].Ecriture(0,1,5);

long valeur;
resultat = Tableau3d[0].Lecture(0,1,valeur);
cout << "Lecture : " << valeur << endl;