Advertisement
Guest User

Untitled

a guest
Sep 24th, 2018
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int sort(int ncol, int nlines, int a[])
  5. {
  6.    
  7.     for (int i = 0; i < 3; i++)
  8.     {
  9.         for (int j = 0; j < 3; j++)
  10.         {
  11.             if (a[i * ncol + j] < a[ncol * 0])
  12.             {
  13.                 a[ncol * 0] = a[i *ncol + j];
  14.             }
  15.         }
  16.     }
  17.  
  18.     return a[ncol * 0];
  19.  
  20. }
  21.  
  22. int main()
  23. {
  24.     int n[3][3];
  25.     int num = 0;
  26.     int n1;
  27.  
  28.     for (int j = 0; j < 3; j++)
  29.     {
  30.         for (int i = 0; i < 3; i++)
  31.         {
  32.             cin >> n1;
  33.             n[j][i] = { n1 };
  34.         }
  35.     }
  36.  
  37.  
  38.     num = sort(3,3, &n[0][0]);
  39.  
  40.     cout << num;
  41.  
  42.     return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement