
On Jan 8, 2009, at 5:08 PM, Steven Watanabe wrote:
AMDG
Mark Volkmann wrote:
The first thing I'm trying to do is determine how to represent a velocity in miles per hour. I haven't been able to figure it out from the documentation. Any hints would be appreciated.
// Get the associated base units #include
#include // Create short typedefs for the components. typedef boost::units::us::mile_base_unit::unit_type mile_unit; typedef boost::units::metric::hour_base_unit::unit_type hour_unit; // make the unit for miles/hour typedef boost::units::divide_typeof_helper ::type miles_per_hour; quantity
mph = 80.0*miles_per_hour(); I also need to figure out the best way to get string representations of quantities that include their units for output.
#include
will give you operator<<.
Thanks!
Why does the the following simple code output "605mi h^-1" instead of
"605 mi/h"? Why is the "^-1" at the end?
#include <iostream>
#include