LabiinfaCibGyti

rgz16

Dec 7th, 2019
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.47 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <math.h>
  4. #include "16bibl.h"
  5. using namespace std;
  6. int _tmain(int argc, _TCHAR* argv[])
  7. {
  8.     int a[6][4], i, j, s;
  9.     setlocale (0,"rus");
  10.     cout<<"Матрица 1"<<endl;
  11.     func3(a);
  12.     cout<<endl;
  13.     s=func(a);
  14.     cout<<"Сумма положительных четных элементов= "<<s<<endl;
  15.     cout<<endl;
  16.     cout<<"Измененная матрица"<<endl;
  17.     func2(a);
  18.     for (i=0;i<6;i++)
  19.     {
  20.         for (j=0;j<4;j++)
  21.         {
  22.             cout<<a[i][j]<<"\t";
  23.         }
  24.         cout<<endl;
  25.     }
  26.     return 0;
  27. }
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35. #include "stdafx.h"
  36. #include <iostream>
  37. #include <math.h>
  38. #include "16bibl.h"
  39. using namespace std;
  40. double func(int a[6][4])
  41. {  
  42.     int i, j, max=-300000;
  43.     for (i=0; i<6; i++)
  44.         {
  45.             for (j=0; j<4; j++)
  46.             {
  47.                 if (a[i][j]%2==0 && a[i][j]>max)
  48.             max=a[i][j];
  49.         }
  50.     }
  51. return (max);    
  52. }
  53. void func2(int a[6][4])
  54. {
  55.     int i, j=0;
  56.     for (i=0; i<6; i++)
  57.     {
  58.         a[i][3]=a[i][3]*3;
  59.     }
  60. }
  61. void func3 (int a[6][4])
  62. {
  63.     int i, j;
  64.     for (i=0;i<6;i++)
  65.     {
  66.         for (j=0;j<4;j++)
  67.         {
  68.             a[i][j]=-10+rand()%20;
  69.         }
  70.     }
  71. for (i=0;i<6;i++)
  72.     {
  73.         for (j=0;j<4;j++)
  74.         {
  75.             cout<<a[i][j]<<"\t";
  76.         }
  77.         cout<<endl;
  78. }
  79. }
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89. double func(int a[6][4]);
  90. void func2 (int a[6][4]);
  91. void func3 (int a[6][4]);
Advertisement
Add Comment
Please, Sign In to add comment