Friday, July 31, 2009

C++ trouble?

I am having trouble to simplify the answer.


using namespace std;


int main(){


double dblA, dblB, dblC, dblD, dblproductN, dblproductD,dblsumN,dblsumD, dblGCF, dblsimplifyNsum, dblsimplifyDsum;


double dblsimplifyNproduct, dblsimplifySproduct;


int M,N;


int R=M%N;


while(R!=0)


{M=N;


N=R;


R=M%N;}





{


cout%26lt;%26lt;"Enter the numerator and the denomenator of the first positive fraction separated by a space=%26gt;"%26lt;%26lt;endl;


cin%26gt;%26gt;dblA%26gt;%26gt;dblB;


cout%26lt;%26lt;"Enter the numerator and the denaminator of the second positive fraction separated by a space=%26gt;"%26lt;%26lt;endl;


cin%26gt;%26gt;dblC%26gt;%26gt;dblD;


dblproductN =(dblA*dblC);


dblproductD =(dblB*dblD);


dblsumN = (dblA*dblD)+(dblC*dblB);


//dblGCF = N;


//dblsimplifyNsum= (dblsumN)/(dblGCF);


//dblsimplifyDsum= (dblproductD)/(dblGCF);


//dblsimplifyNproduct= (dblproductN) / (dblGCF);


//dblsimplifySproduct = (dblproductD) / (dblGCF);


cout%26lt;%26lt;"the sum of the fractions is" %26lt;%26lt;dblsu

C++ trouble?
http://en.wikipedia.org/wiki/Euclidean_a...


http://en.wikipedia.org/wiki/Binary_GCD_...


No comments:

Post a Comment