next up previous contents
Next: Fixed Precision Floating Point Up: Integers Modulo a Prime Previous: Header Files

Usage Examples

  #include "intmodp.h"

  IntModp::prime = 13;               // Set the global prime to 13
  int
  main(int argc, char** argv)
  {
    IntModp a = 5;                    // Creates a IntModp type with value 5 
    IntModp b = 8;                    // Creates a IntModp type with value 8 
    IntModp c = a+b ;                 // Add a + b % 13 and store in c. 
    cout << c;                        // Prints result to standard output. 
    if (is_zero(c))                   // Test for zero
      cout << "Result is 0\n"; 
  }

1.0



Ashu Rege
Fri May 9 17:57:21 PDT 1997