Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <math.h>
- using namespace std;
- int _tmain(int argc, _TCHAR* argv[])
- {
- int i, j,k=0;
- double max=-20;
- double a[5][5]={ {-3.8, 0, 5.3, 4.5, 0.5,},
- {0.2, -1.3, 0, -8.5, 3.5,},
- {-1.1, 1.8, 5.1, -8.2, 0.32,},
- {0, -0.3, 0, -1.28, 0.52,},
- {-0.3, 0.5, 1.8, -7.3, 5.5,} };
- double b[25];
- setlocale(0, "rus");
- cout<<"Матрица 1"<<endl;
- for (i=0; i<5;i++)
- {
- for (j=0; j<5; j++)
- {
- cout<<a[i][j]<<"\t\t ";
- }
- cout<<endl;
- }
- for (i=0;i<5;i++)
- {
- for (j=0; j<5-i;j++)
- {
- b[k]=a[i][j];
- k++;
- }
- }
- cout<<endl;
- cout<<"Массив №2"<<endl;
- for (i=0; i<k; i++)
- {
- cout<<b[i]<<endl;
- if (b[i]>max)
- max=b[i];
- }
- cout<<endl;
- cout<<"Максимальный элемент второго массива= "<<max<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement