Advertisement
Guest User

Untitled

a guest
Dec 5th, 2019
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <random>
  4. #include <vector>
  5. #include <fstream>
  6. using namespace std;
  7. string min(string a, string b, string c)
  8. {
  9.     if (a < b && a < c)return a;
  10.     if (b < a && b < c) return b;
  11.     return c;
  12. }
  13. double min(vector<double> numbers)
  14. {
  15.     double a = numbers[0];
  16.     for (int i = 1; i < numbers.size(); i++)
  17.     {
  18.         if (a > numbers[i])
  19.             a = numbers[i];
  20.     }
  21.     return a;
  22. }
  23. int main()
  24. {
  25.     string a, b, c;
  26.     cin >> a >> b >> c;
  27.     string minStr = min(a, b, c);
  28.     cout << minStr << endl;
  29.  
  30.     ifstream file("zzz.txt");
  31.     vector<double> nums;
  32.     double number = 0;
  33.     while (file >> number)
  34.     {
  35.         nums.push_back(number);
  36.     }
  37.     double minVal = min(nums);
  38.     cout << minVal;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement