Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #define _CRT_SECURE_NO_WARNINGS
- using namespace std;
- int main()
- {
- int c[4][5];
- int jmax;
- int sum = 0, sum_max = 0, temp = 0;
- for(int i = 0; i< 4; i++) //вовод массива
- {
- for(int j = 0; j < 5; j++)
- {
- cout << "Введите C[" << i << ' ' << j <<"]: ";
- cin >> c[i][j];
- }
- }
- cout << '\n';
- for(int j = 1 ; j < 5; j++)
- {
- sum = c[0][j]+c[1][j]+c[2][j]+c[3][j]+c[4][j]; //вычисление суммы
- if(sum > sum_max) //определение максимальной суммы
- {
- sum_max = sum;
- jmax = j;
- }
- }
- for(int i = 0; i < 4; i++ )
- {
- temp = c[i][jmax]; //замена столбцов
- c[i][0] = temp;
- }
- for(int i=0; i < 4; i++)
- {
- for(int j=0;j < 5;j++)
- {
- cout << c[i][j] << ' ';
- }
- cout << '\n';
- }
- getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement