Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2014
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. #include <iostream>
  2. #include <string.h>
  3. using namespace std;
  4.  
  5. const int SIZE_1 = 3;
  6. const int COLOM =  3, ROWS = 5;
  7. const int SIZE_2 = 10;
  8.  
  9. void fillInMatrix(int arr[], int size, int numOfJump, int num);
  10.  
  11. void main()
  12. {
  13.     int* p;
  14.     int matrix[SIZE_2][SIZE_2] = { 0 };
  15.  
  16.     for (int i = 1; i < SIZE_2; i++)
  17.     {
  18.         fillInMatrix((int*)matrix + i, SIZE_2*SIZE_2, 10, i);
  19.  
  20.     }
  21.     for (int i = 0; i < SIZE_2; i++)
  22.     {
  23.         for (int j = 0; j < SIZE_2; j++)
  24.         {
  25.             cout << matrix[i][j] << " ";
  26.         }
  27.         cout << endl;
  28.     }
  29.     system("pause");
  30. }
  31.     void fillInMatrix(int arr[], int size, int numOfJump, int num)
  32.     {
  33.         int *p;
  34.         for (p = arr; p<arr + size; p++)
  35.         {
  36.             if ((p - arr) % numOfJump == 0)
  37.                 *p = num;
  38.         }
  39.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement