Im trying to write RSA program in c++ and i get that Error

-1

Unhandled exception at 0x009B1A39 in rsa.exe: 0xC00000FD: Stack overflow (parameters: 0x00000001, 0x00802FEC). the debug says that the problem is at the gcd if line;

int prime() { 
int num = rand() % (100-2+1);
int i = 2;
for (i; i<num; i++)
    if (num % i == 0) num = prime();
return num;
}

int gcd(int phi) {
int num = prime();
if (phi % num != 1) num=gcd(phi);
else return num;
}

help pls?

c++

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0