Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <math.h>
- #include "16bibl.h"
- using namespace std;
- int _tmain(int argc, _TCHAR* argv[])
- {
- int a[6][4], i, j, s;
- setlocale (0,"rus");
- cout<<"Матрица 1"<<endl;
- func3(a);
- cout<<endl;
- s=func(a);
- cout<<"Сумма положительных четных элементов= "<<s<<endl;
- cout<<endl;
- cout<<"Измененная матрица"<<endl;
- func2(a);
- for (i=0;i<6;i++)
- {
- for (j=0;j<4;j++)
- {
- cout<<a[i][j]<<"\t";
- }
- cout<<endl;
- }
- return 0;
- }
- #include "stdafx.h"
- #include <iostream>
- #include <math.h>
- #include "16bibl.h"
- using namespace std;
- double func(int a[6][4])
- {
- int i, j, max=-300000;
- for (i=0; i<6; i++)
- {
- for (j=0; j<4; j++)
- {
- if (a[i][j]%2==0 && a[i][j]>max)
- max=a[i][j];
- }
- }
- return (max);
- }
- void func2(int a[6][4])
- {
- int i, j=0;
- for (i=0; i<6; i++)
- {
- a[i][3]=a[i][3]*3;
- }
- }
- void func3 (int a[6][4])
- {
- int i, j;
- for (i=0;i<6;i++)
- {
- for (j=0;j<4;j++)
- {
- a[i][j]=-10+rand()%20;
- }
- }
- for (i=0;i<6;i++)
- {
- for (j=0;j<4;j++)
- {
- cout<<a[i][j]<<"\t";
- }
- cout<<endl;
- }
- }
- double func(int a[6][4]);
- void func2 (int a[6][4]);
- void func3 (int a[6][4]);
Advertisement
Add Comment
Please, Sign In to add comment