crsandu

pb2-clasa

Nov 5th, 2016
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6.  
  7. /*Io, Flavius Remusian Rozalian, daclar pa propia raspundere*/
  8. /* Daca cere si Ionela, schimba Textul de mai sus (doar numele) */
  9.  
  10. ifstream fin("Numere.txt");
  11. ofstream fout("Date.out");
  12.  
  13. int minim(int &a, int &b, int k)
  14. {
  15.     int m, p;
  16.     if (k > 0)
  17.     {
  18.         fin >> p;
  19.         m = minim(a, b, k-1);
  20.         if (p < m && p >= a)
  21.         {
  22.             m = p;
  23.         }
  24.     }
  25.     if (k == 0)
  26.     {
  27.         fin >> a >> b;
  28.         m = b;
  29.     }
  30.     return m;
  31. }
  32.  
  33. int n, mini, a, b;
  34.  
  35. int main()
  36. {
  37.     fin >> n;
  38.     mini = minim(a, b, n);
  39.     cout << mini; /*Nu mai am chef sa il fac pe tot*/
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment