
AMDG Terry Golubiewski wrote:
I am having trouble seeing how to use mixed units. The program below compiles and runs. See the changes I "wish" I could make as comments.
terry
#include
#include #include #include #include <iostream> #include <iomanip>
using namespace std; using namespace boost; using namespace boost::units;
int main() { static const si::length m = si::meter; // static const si::length ft = ???; typedef quantitysi::length Length; Length x = 2.0 * m; Length y = 3.0 * m; // instead of "m" use "ft"; cout << "x=" << x << " y=" << y << endl; Length z = x + y; cout << "x+y=" << z << endl; // display result in "ft" return 0; } // main
Warning: untested code typedef quanttyus::foot_base_unit::unit_type Length; Length x(2.0 * m); In Christ, Steven Watanabe