#include #include "height.h" using namespace std; // Constructor: from feet and inches height::height(int f, double i) : _centimeters{2.54 * (12 * f + i)} { } // Constructor: from total inches height::height(double i) : _centimeters{2.54 * i} { } // Default constructor: zero height height::height() : _centimeters{0.0} { } // Print in feet and inches void height::print() const { const double totalInches = _centimeters / 2.54; const int feet = static_cast(totalInches) / 12; const double inches = totalInches - 12 * feet; cout << feet << " feet, " << inches << " inches"; } // Public getter for centimeters double height::centimeters() const { return _centimeters; } // Friend function: distance in inches double distance(const height& h1, const height& h2) { return (h1._centimeters - h2._centimeters) / 2.54; }