Advertisement
tobast

Untitled

Dec 26th, 2012
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. #include <cstdio>
  2. #include <cstdlib>
  3. #include <ctime>
  4.  
  5. const int ARRAY_SIZE = 100;
  6.  
  7. void printline(int line[ARRAY_SIZE], int linesize) // AFFICHE UNE LIGNE.
  8. {
  9.     for(int pos=0; pos < linesize; pos++)
  10.         printf("%d ", line[pos]);
  11.     printf("\n");
  12. }
  13.  
  14. int main(void)
  15. {
  16.     srand(time(NULL));
  17.     int array[ARRAY_SIZE][ARRAY_SIZE];
  18.     for(int row=0; row < ARRAY_SIZE; row++)
  19.         for(int col=0; col < ARRAY_SIZE; col++)
  20.             array[row][col] = rand() % 1000;
  21.  
  22.  
  23.     printline(array[rand() % ARRAY_SIZE], ARRAY_SIZE); // affiche une ligne au hasard, en la passant directement __IMPORTANT__
  24.  
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement