#include #include #include using namespace std; const int nx = 4, ny = 5; const int naff = 5; void affiche ( double** tableau ) { for ( int j = 0; j < ny; j++ ) { for ( int i = 0; i < nx; i++ ) { cout << setw ( naff ) << tableau[j][i]; } cout << endl; } cout << endl; } double** créer ( int tx, int ty ) { double** tableau = static_cast ( 0 ); tableau = new double*[tx]; // initialiser les ty pointeurs à 0 (NULL) std::fill_n( tableau, ty, static_cast( 0 ) ); for ( int i = 0; i < ty; i++ ) { tableau[i] = new double[tx]; } return tableau; } int détruire ( double** tableau, int ty ) { for ( int i = 0; i < ty; i++ ) { delete[] tableau[i]; } delete[] tableau; return 0; } int main () { double** surface = créer ( nx, ny );; for ( int j = 0; j < ny; j++ ) { for ( int i = 0; i < nx; i++ ) { surface[j][i] = i*10 + j; } } cout << "Matrice d'entrée :" << endl; affiche ( surface ); détruire ( surface, ny ); system ( "pause" ); }