123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
#include <iostream> using namespace std; void Lines(int mat[2][2], int vect1[]) { int i, j; vect1[0] = 0; for(i=0; i<2; i++) { for (j=0; j<2;j++) { if( mat[i][j] > vect1[0] ) { vect1[i] = mat[i][j]; } } } cout << "biggest element of the line: \n"; for (int i=0; i<2; i++) { cout << vect1[i] << "\n"; } } int Columns(int mat[2][2], int vect2[]) { int i, j; vect2[0] = 0; for(i=0; i<2; i++) { for(j=0; j<2; j++) { if( mat[i][j] > vect2[0] ) { vect2[i] = mat[i][j]; } } } cout << "biggest element of the column: \n"; for (int i=0; i<2; i++) { cout << vect2[i] << " "; } } int readarray(int mat[2][2]) { for (int i=0; i<2; i++) { for (int j=0; j<2; j++) { cout << "insert element: " << endl; cin >> mat[i][j]; } } } int main() { int array[2][2], vector1[2], vector2[2]; readarray(matriz); lines(matriz,vector1); lines(matriz,vector2); return 0; }
array
matriz
lines
Lines
vect1[0]
vect1[i]
vect2[0]
vect2[i]
vect1[i] = 0;
vect2[i] = 0;