this is the new code.
Code:
#include <iostream.h>
int GCD(int a, int b )
{
int remainder, quotient, divisor, numerator;
if (a > b)
{
remainder=a%b;
quotient=a/b; divisor=b;
}
else
{
remainder=b%a;
quotient=b/a;divisor=a;
}
while( remainder!=0 )
{
numerator=divisor;
divisor=quotient;
remainder=numerator%divisor;
quotient=numerator/divisor;
}
return divisor;
}
int simplify1(int a, int GCD )
{
int product1;
{
do
{
product1=a / GCD;
}
while ( a!=0);
}
return product1;
}
int simplify2(int b, int GCD )
int product2; // error 1
{ // error 2
do
{
product2=b / GCD;
}
while ( b!=0 );
}
return product2;
int main()
{
int w, x;
char junk;
cout << "This program allows calculating the GCD\n";
cout << "Value of first numerator: ";
cin >> w;
cout << "Value of first denominator: ";
cin >> x;
cout << "\nThe Greatest Common Divisor of "
<< w << " and " << x << " is " << GCD(w, x) << endl;
cout << "\nThe simplified fraction is "
<< w << " and " << x << simplify1(w,GCD(w, x)) << " and "<<
simplify2(x,GCD(w, x)) << endl;
cin >> junk; //This input allows for display.
return 0;
}
and here is the errors
Code:
Info :Compiling C:\Documents and Settings\labpc\Desktop\fraction hoskins beta v2.cpp
Error: fraction hoskins beta v2.cpp(44,5):Declaration syntax error
Error: fraction hoskins beta v2.cpp(45,8):Declaration terminated incorrectly