Files
hole-calc/calc.cpp
2023-10-23 18:07:52 +00:00

14 lines
402 B
C++

using namespace std;
extern "C" double hole_calc(double volume, double diameter)
{
// Convert diameter to radius
double radius = diameter / 2.0;
//Calculate the volume in cubic inches
double volumeInCubicInches = volume * 1728.00;
// Calculate the depth using the volume, radius, and pi
double depth = volumeInCubicInches / ((radius * radius) * 3.141592);
return depth;
}