extended GCD algorithm
<p>i have wrote following algorith for extended GCD algorithm,just dont know how to return triple and could anybody help me?</p>

<pre><code>#include&lt;iostream&gt;
#include&lt;math.h&gt;
using namespace std;
int gcd(int a,int b) {  return (b==0 ?a:gcd(b,a%b));}
long long gcd(long a,long b) { return (b==0 ?a:gcd(b,a%b));}
template&lt;class Int&gt; Int gcd(Int a,Int b) { return (b==0 ?a:gcd(b,a%b));}
template&lt;class Int&gt;
struct Triple
{
  Int d,x,y;
  Triple(Int q,Int w,Int e) :d(q),x(w),y(e)) {}

};

//extended GCD
/* computes d=gcd(a,b)
also x and y such that d=a*x+y*b and return tripls (d,x,y)
                                 */
template&lt;class Int&gt;
Triple &lt;Int&gt; egcd(Int a,Int b) {

   if(!b) return Triple&lt;Int&gt;(a,Int(1),Int(0));
   Triple&lt;int&gt;q=egcd(b,a%b);
   return Triple&lt;Int&gt;(q.d,q.y,q.x-a/b*q.y);
    }

int main(){

     int a=35;
     int b=13;




 return 0;
}
</code></pre>

<p>how to finish it using my triple struct constructor?please help me</p>
