This program must run in the visual cnet some time i have


I need help to writing a program "VC++.net"with the specified input and output.

Please, Implement the Chinese Remainder Theorem. Allowing at least 3 pairwise relatively prime positive integers.

Please attention

This program must run in the Visual C++.NET. Some time I have problem with that, so, please the whole project included in the attached Zip file.

I already tried writing this program but I couldn't run it. I send that, I hope be useful.

//project #1

#include
#include
#include

int gcd(int,int);
int inverse(int,int);

void main(){

int x, Remainder[4], Num[4], M=1, Ma[4], Myarray[4]={0,0,0,0},i;

for (i=0; i<4; i++)

{

cout<<" nn X = A (MODULUS M) nn";
cout<<" PLEASE ENTER YOUR NUMBER :nnn ";
cin>>Remainder[i];
cout<<" PLEASE ENTER YOUR NEXT NUMBER :nnn";

cin>>Num[i];
cout<<" AND NOW YOUR NUMBER IS = "

<< Remainder[i] << " ( mod " << Num[i]<< " ) ";

M = M * Num[i];

cout<

Ma[i] = M/Num[i];
cout<< " nn M = "<< Ma[i] << "Modulus" << Num[i]<<" ( "<< Ma[i] <<" = "<< Remainder[i]<<" )n";

Myarray[i]= gcd(Ma[i], Num[i]);
Myarray[i]= inverse(Ma[i], Num[i]);

x=Remainder[0]*Ma[0]*Myarray[0]+Remainder[1]*Ma[1]*Myarray[1]+Remainder[2]*Ma[2]*Myarray[2];
x=x%M;
cout <cout<<" x = "<}

system ("pause");
}
int inverse(int a, int b)
{
int x=1;

while (a*x%b !=1)
{
x++;
}
return x;
}

int gcd(int Num, int n)
{

int Remainder;
while (n!=0)
{
Remainder = Num %n;
Num=n;
n=Remainder;
}
return Num;
}

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: This program must run in the visual cnet some time i have
Reference No:- TGS01247815

Now Priced at $20 (50% Discount)

Recommended (93%)

Rated (4.5/5)