// file: $isip/doc/examples/class/math/scalar/math_scalar_example_00/example.cc // version: $Id: example.cc 5953 2000-12-17 18:17:48Z hamaker $ // // isip include files // #include #include #include // main program starts here // this example shows how classes and operators can be used in place of // integral types // int main() { // declare some objects // Long a(2); Float b(2.0), c(3.5), d(3.0); Float e; // perform a simple math operation: // note that, due to precedence, the addition will take place // last. Since the variable 'a' is a Long object, the result of // (b * c) / d will be truncated before addition. // e = a + (b * c) / d; // output the value // e.debug(L"a + (b * c) / d"); // perform the same operation with all floating point numbers: // this time, since 'f' is a Float object, the result will not // be truncated before addition // Float f(2); Float g; g = f + (b * c) / d; // output the value // g.debug(L"f + (b * c) / d"); // exit gracefully // Integral::exit(); }