SHARE
TWEET

Punct sa/Saddle point c++

AlexandruFilipescu Nov 12th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <time.h>
  3. #include <stdio.h>
  4.  
  5. using namespace std;
  6. #define nr_lin 5
  7. #define nr_col 5
  8.  
  9. int main() {
  10.     srand(time(0));
  11.     int i, j, nr_inc = 1, min = INT_MAX, max = INT_MIN,vect_col[nr_col],
  12.     vect_lin[nr_lin],vect_min[nr_col],vect_rez[nr_col],col_dor, lin_dor,int_mare=0, cont_vect = 0,incr=0;
  13.     bool mare;
  14.     int mat[nr_lin][nr_col] = { 5,12,7, 3,12,
  15.                                 4, 10,6, 2,8,
  16.                                 10,24,17,7,10,
  17.                                 9,21,10,8,12,
  18.                                 2,18,22,4,15};
  19.  
  20.  
  21.  
  22.     for (i = 0; i < nr_lin; i++) {
  23.         for (j = 0; j < nr_col; j++) {
  24.             cout << mat[i][j] << "  ";
  25.         }
  26.         cout << endl;
  27.     }
  28.  
  29.     cout << endl;
  30.    
  31.     for (i = 0; i < nr_lin;i++) {
  32.         for (j = 0; j < nr_col;j++) {
  33.             if (mat[i][j]<min) {
  34.                 min = mat[i][j];
  35.                 col_dor = j;
  36.                 lin_dor = i;
  37.             }
  38.         }
  39.         vect_col[cont_vect] = col_dor;
  40.         vect_lin[cont_vect] = lin_dor;
  41.         vect_min[cont_vect++] = min;
  42.         min = INT_MAX;
  43.     }
  44.    
  45.     for (i = 0; i < nr_lin;i++) {
  46.         for (j = 0; j < nr_col;j++) {
  47.             if (mat[i][vect_col[incr]] < mat[j][vect_col[incr]]) {
  48.                 mare = false;
  49.                 break;
  50.             }
  51.         }
  52.         if (mare) {
  53.             vect_rez[int_mare++] = mat[i][vect_col[incr]];
  54.         }
  55.         mare = true;
  56.         incr++;
  57.     }
  58.    
  59.    
  60.     for (i = 0; i <int_mare; i++) {
  61.         cout << vect_rez[i] << " Este numar sa" << endl;
  62.     }
  63.  
  64.    
  65.    
  66.  
  67.     system("pause");
  68. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top