Advertisement
kirya_shkolnik

Функция минимума

Sep 7th, 2022
985
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. #include <cmath>
  4.  
  5. using namespace std;
  6.  
  7. float min(float a, float b){
  8.     if(a < b) return a;
  9.     else return b;
  10. }
  11.  
  12.  
  13. int main()
  14. {
  15.     float a,b;
  16.     cout << "Введите a,b:"<< endl;
  17.     cin >> a >> b;
  18.     float u = min(a,b);
  19.     float v = min(a*b, a+b);
  20.     float f = min(a+pow(b,2),3.14);
  21.     cout << "a = " << a << " b = " << b << endl;
  22.     cout << "u = min(a,b) = " << u << endl
  23.     << "v = min(a*b, a+b) = " << v << endl
  24.     << "f = min(a+pow(b,2),3.14) = " << f << endl;
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement