|
Boost : |
From: Terje Slettebø (tslettebo_at_[hidden])
Date: 2003-05-01 18:03:11
>From: "Terje Slettebø" <tslettebo_at_[hidden]>
Just to correct this a little.
> // Demonstrating ohm's law: U=R * I
>
> ohm<double> r(10); // 10 Ω. May also use "electric_resistance<>"
> ampere<double> u(2); // 2 A. May also use "A<>" or "electric_current<>"
>
> std::cout << u/r; // Output: "2 V" or "2 volt", or "2 kgâm^2/(s^3âA)", or
> something else, depending on the format setting
I had changed the example some (it used to be I = U/R), and it wasn't
completely changed. A proper example is:
// Demonstrating ohm's law: U=R * I
ohm<double> R(5); // 5 Ω. May also use "electric_resistance<>"
ampere<double> I(2); // 2 A. May also use "A<>" or "electric_current<>"
std::cout << R * I; // Output: "10 V" or "10 volt", or "10 kgâm^2/(s^3âA)",
or
something else, depending on the format setting
> frequency<double> value1;
> angular_velocity<double> value2;
This should be:
frequency<double> value1(1.23);
angular_velocity<double> value2(1.23);
> std::cout << value1; // Output: "1.23 Hz"
> std::cout << value2; // Output: "1.23 rad/s"
Regards,
Terje
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk