Code:
#include "stdafx.h"
#include <iostream>
using namespace std;
int simplify(int x2 ,int y2 ,int gcd ,int a ,int b )
{
a= x2/gcd;(simplify its counting a and b)
b= y2/gcd;
return (x2,y2,gcd,a,b); now its returning the x2,y2,gcd,a,b but the value of and b its different
}
int gcd(int x2, int y2)
{
int i;
int gcd2;
for (i=1; i<=x2; i++)
{
if((x2%i==0) && (y2%i==0))
gcd2 = i;
}
return gcd2;
}
int multiply()
{
int numerator,denominator,numerator2,denominator2 ;
int x;
int x2, t2;
int c;
int d;
cout<<"Input the numerator and denominator of a fraction separated by spaces :"<<endl;
cin>>numerator;
cin>>denominator;
cout<<"Input the numerator and denominator of a fraction separated by spaces :"<<endl;
cin>>numerator2;
cin>>denominator2;
cout<<"Input instruction*_" << endl;
x2 = numerator*numerator2;
t2 =denominator*denominator2;
x=gcd( x2, t2);
simplify( x2 , t2 ,x , c , d); here im sending arguments to simplify(1) 3)its returning the values here
cout<<"("<< numerator << "/"<<denominator <<") * ("<< numerator2 <<"/"<< denominator2 <<") = " << c << "/" << d;
cout << "\n";
return 0;
}
int main()
{
multiply();
system ("PAUSE");
}
Why c and d its 0??????