// LongIntExample.cpp : // This file is just an example of how to work with the object LongInt. #include "LongInt.h" int _tmain(int argc, _TCHAR* argv[]) { // Initialization LongInt x(1), y(42), z(y); // Output procedures x.DecOutput("x"); y.DecOutput("y"); z.DecOutput("z"); // Another way of initialization z="4151368860"; z.DecOutput("Stream Initialization of z"); // Arithmetical operations x=z*y; // this is just a multiplication z*=y; // this is the same multiplication, but works faster! x.DecOutput("x =z*y"); z.DecOutput("z*=y "); // Modulo, Division and Power and Logarithm functions printf("Logarithm by the base 2: log(z) = %lf\n", z.ddegree()); z=z.powfn(.5); // square root with truncation z.DecOutput("z=sqrt(z)"); (z*z).DecOutput("z*z"); // this is to check the sqrt (z%y).DecOutput("Modulo z%y"); (z/y).DecOutput("Division z/y"); // Modulo and Division for Integer values (Fast!) long val=42; printf("The (long)-valued result for (z) mod 42: %ld\n", z%val); z/=val; z.DecOutput("Division by (long)-value (z) div 42"); // Factoring features int pwr=0, base=2; z="92154678365472"; z.DecOutput(); printf(" = %ld^", base); while(z.Divide_If_Divisible(base)) pwr++; printf("%ld * ", pwr); z.DecOutput(); return 0; }