Home Article Practice C++

C++

2023-12-11 14:17  views:647  source:rocketman_leo    

#include <iostream>
#include <iomanip>
using namespace std;
int max(int, int, int); //申明找最大数函数
int main() {
/*m =3 / (3 * 5)
*/
int a, b, c;
double m;
cin >> a >> b >> c;
m = 1.0 * max(a,b, c) / (max(a+b, b, c) * max(a, b, b+c));
cout << fixed << setprecision(3)<< endl;
cout << m << endl;
cout << "m = " << max(a,b, c) << " / (" << max(a+b, b, c) << " * "
<< max(a, b, b+c) << ')'<< endl;
return 0;
}
int max(int a, int b, int c)
{
int temp = a;
if(a < b)
{
temp = b;
}
if(temp < c)
temp = c;
return temp;
}



Disclaimer: The above articles are added by users themselves and are only for typing and communication purposes. They do not represent the views of this website, and this website does not assume any legal responsibility. This statement is hereby made! If there is any infringement of your rights, please contact us promptly to delete it.

字符:    改为:
去打字就可以设置个性皮肤啦!(O ^ ~ ^ O)