Created
November 13, 2019 18:14
-
-
Save fenske/58bb4c53bb885dff95f5c3a5fb682c7f to your computer and use it in GitHub Desktop.
Revisions
-
fenske created this gist
Nov 13, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,57 @@ #include <iostream> #include <cmath> using namespace std; #define N 3 // Количество строк матрицы А, сумма элементов каждой из которых меньше нуля. void f(int x[N], int y[N]) { int k = 0; for (int i = 0; i < N; i++) { cout << x[i] << " "; } cout << endl; for (int i = 0; i < N; i++) { cout << y[i] << " "; } cout << endl; int t[N]; t[0] = INT_MIN; t[1] = INT_MIN; t[2] = INT_MIN; for (int i = 0; i < N; i++) { if (y[i] > x[i]) t[i] = y[i]; else { t[i] = x[i]; k++; } } for (int i = 0; i < N; i++) { cout << t[i] << " "; } cout << endl; cout << "k = " << k << endl; } int main() { int x[N]; x[0] = 1; x[1] = 5; x[2] = 3; int y[N]; y[0] = 4; y[1] = 2; y[2] = 6; f(x, y); return 0; }