So here is the code (the program calculates the area of ring with specified outter and inner radiuses, nothing too special):
#include <iostream>
bool f(double ro, double ri, double &s)
{
const double eps = 1e-12;
if (ro > ri + eps)
{
const double pi = acos(-1);
//s = pi * (ro * ro) - pi * (ri * ri);
s = pi * (ro + ri) * (ro - ri);
return true;
}
return false;
}
int main()
{
double s = 0;
double ro, ri;
std::cin >> ro >> ri;
std::cout << f(ro, ri, s) << ' ' << s << '\n';
std::cout << s;
}
The question is, why, for example, for input
5 4
the output will be
1 0
28.2743
, not
1 28.2743
28.2743
?