main.cpp 621 B

1234567891011121314151617181920212223242526272829303132
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4. int main()
  5. {
  6. const int tailleX(12);
  7. const int tailleY(7);
  8. int **tableau;
  9. tableau = new int*[tailleY];
  10. for (int i(0); i<tailleY; i++)
  11. tableau[i] = new int[tailleX];
  12. for (int i(0); i<tailleY*tailleX; i++)
  13. tableau[i/tailleX][i%tailleX] = i+10;
  14. for (int y(0); y < tailleY; y++)
  15. {
  16. for (int x(0); x < tailleX; x++)
  17. cout << tableau[y][x] << " ";
  18. cout << endl;
  19. }
  20. for (int i(0); i<tailleY; i++)
  21. delete[] tableau[i];
  22. delete[] tableau;
  23. tableau = 0;
  24. return 0;
  25. }