I wrote a program for a class where I need to recursively evaluate the extended Euclidean algorithm for a and b, returning G, the largest common factor, as well as s and t from as + bt = gcd (a, b). I am pretty sure that I have a function that is written correctly, but I am having problems with the values โโpassed to and from the function. I haven't coded after a while and recently wrote pseudo code, so I'm a little rusty.
For example, I wrote when b = 0, return (a, 1, 0), but when I enter b as 0, I return (0, 0, 0) and cannot understand why this is happening. Any help or guidance would be greatly appreciated.
c ++ algorithm parameters
Fluke
source share