-1

Can anyone help me with this? The function "mpz_mod" is wrong but i don't know how to fix it.

#include <iostream>
#include <gmp.h>
#include <gmpxx.h>
using namespace std;
int main ()
{
   mpz_class p;
   mpz_class y;
   mpz_class m;
   for ( p=100 ; p<=500 ; p=p++)
      {
         for ( y=50 ; y<=60 ; y=y++)
            {
               mpz_mod (m,p,y);
            }
          if (m==0)
          cout << p << "," << y << "  ok  " <<endl;
      }
}
dimig
  • 1
  • 3

1 Answers1

1

mpz_mod is for C code, and takes mpz_t * as arguments. Since you're using C++ and mpz_class, you want m = p % y;

Chris Dodd
  • 119,907
  • 13
  • 134
  • 226