Advertisement
Guest User

Untitled

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