Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <time.h>
- #include <stdio.h>
- using namespace std;
- #define nr_lin 5
- #define nr_col 5
- int main() {
- srand(time(0));
- int i, j, nr_inc = 1, min = INT_MAX, max = INT_MIN,vect_col[nr_col],
- vect_lin[nr_lin],vect_min[nr_col],vect_rez[nr_col],col_dor, lin_dor,int_mare=0, cont_vect = 0,incr=0;
- bool mare;
- int mat[nr_lin][nr_col] = { 5,12,7, 3,12,
- 4, 10,6, 2,8,
- 10,24,17,7,10,
- 9,21,10,8,12,
- 2,18,22,4,15};
- for (i = 0; i < nr_lin; i++) {
- for (j = 0; j < nr_col; j++) {
- cout << mat[i][j] << " ";
- }
- cout << endl;
- }
- cout << endl;
- for (i = 0; i < nr_lin;i++) {
- for (j = 0; j < nr_col;j++) {
- if (mat[i][j]<min) {
- min = mat[i][j];
- col_dor = j;
- lin_dor = i;
- }
- }
- vect_col[cont_vect] = col_dor;
- vect_lin[cont_vect] = lin_dor;
- vect_min[cont_vect++] = min;
- min = INT_MAX;
- }
- for (i = 0; i < nr_lin;i++) {
- for (j = 0; j < nr_col;j++) {
- if (mat[i][vect_col[incr]] < mat[j][vect_col[incr]]) {
- mare = false;
- break;
- }
- }
- if (mare) {
- vect_rez[int_mare++] = mat[i][vect_col[incr]];
- }
- mare = true;
- incr++;
- }
- for (i = 0; i <int_mare; i++) {
- cout << vect_rez[i] << " Este numar sa" << endl;
- }
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement