Advertisement
LabiinfaCibGyti

laba10.17

Dec 17th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.92 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <math.h>
  4. using namespace std;
  5. void func(int a[5][5])
  6. {
  7. int i, j;
  8. for (i=0;i<5;i++)
  9.     {
  10.         for (j=0;j<5;j++)
  11.         {
  12.             a[i][j]=a[i][j]-(i+j+2);
  13.         }
  14.     }
  15. }
  16. int _tmain(int argc, _TCHAR* argv[])
  17. {
  18.     int i, j, a[5][5];
  19.     setlocale (0,"rus");
  20.     for (i=0; i<5;i++)
  21.     {
  22.         for (j=0; j<5;j++)
  23.         {
  24.         a[i][j]=-10+rand()%20;
  25.         }
  26.     }
  27.     cout<<"Матрица 1"<<endl;
  28.         for (i=0; i<5;i++)
  29.         {
  30.             for (j=0; j<5; j++)
  31.             {
  32.                 cout<<a[i][j]<<"\t";
  33.             }
  34.             cout<<endl;
  35.         }
  36.         cout<<endl;
  37.         func(a);
  38.         cout<<"Матрица 2"<<endl;
  39.         for (i=0; i<5;i++)
  40.         {
  41.             for (j=0; j<5; j++)
  42.             {
  43.                 cout<<a[i][j]<<"\t";
  44.             }
  45.             cout<<endl;
  46.         }  
  47.     return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement