Advertisement
Josif_tepe

Untitled

Mar 22nd, 2021
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.02 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <stack>
  4. #include <fstream>
  5. #include <algorithm>
  6.  
  7. using namespace std;
  8.  
  9. class Point {
  10. private:
  11.     double x, y, z;
  12. public:
  13.     Point(double _x = 1.0, double _y = 1.0, double _z = 1.0) {
  14.         x = _x;
  15.         y = _y;
  16.         z = _z;
  17.     }
  18.     void input() {
  19.         cin >> x >> y >> z;
  20.     }
  21.     double get_x() const {
  22.         return x;
  23.     }
  24.     double get_y() const {
  25.         return y;
  26.     }
  27.     double get_z() const {
  28.         return z;
  29.     }
  30. };
  31. Point min_y_cord(Point niza[], int n) {
  32.     int minimum = 1e9; // 2 * 10^9, posle 2kata stavi 9 nuli
  33.     Point m(0, minimum);
  34.     for(int i = 0; i < n; i++) {
  35.         if(niza[i].get_y() < m.get_y()) {
  36.             m = niza[i];
  37.         }
  38.     }
  39.     return m;
  40. }
  41. int main()
  42. {
  43.     int n;
  44.     cin >> n;
  45.     Point niza[n];
  46.     for(int i = 0; i < n; i++) {
  47.         niza[i].input();
  48.     }
  49.     Point m = min_y_cord(niza, n);
  50.     cout << m.get_x() << " " << m.get_y() << " " << m.get_z() << endl;
  51.     return 0;
  52. }
  53.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement