Adding Fractions using functions

I have to add two fractions and have the sum be simplified. Here is what I have so far. I can't figure it out at all...we have to use 5 functions including the main. Thanks in advance for any help!

#include <math.h>
#include <iostream>
using namespace std;

void FindGreatestCommonDivider(int, int, int, int, int&, int&);
void CalculateSum(int, int, int&);
int ReadInputtedData(int Num,int Den,int Num2,int Den2);
int EndResult(int Num,int Den,int Num2,int Den2,int SumNum,int SumDen);
void main()
{
int Num,Den,Num2,Den2,SumNum,SumDen;
char Ch;

do
{
cout << "This program adds fractions. 'Y' continues, any other key exits program";
cout << "\n=======================================================================";
cout << "\nEnter Numerator 1==> ";
cin >> Num;
cout << "\nEnter Denominator 1==> ";
cin >> Den;
cout << endl;
cout << "\nEnter Numberator 2==> ";
cin >> Num2;
cout << endl;
cout << "Enter Denominator 2==> ";
cin >> Den2;

}
while (Ch='Y');

EndResult(Num,Den,Num2,Den2,SumNum,SumDen);

cin.ignore(2);
}
/************************************ReadInputtedData********************************
Description: Read the inputed data for the program
Parameters:
IN:int, the numberators and denominators
OUT:int Fraction creates an outputted fraction
Retuns: Nothing
Precoditions:must be a positive integer less than 50
***********************************************************************************/
int ReadInputtedData (int Num, int Den, int Num2, int Den2)
{


return 0;
}

/************************************FindGreatestCommonDivider********************************
Description: Read the inputed data for the program
Parameters:
IN:int, the numberators and denominators
OUT:int Fraction creates an outputted fraction
Retuns: Nothing
Precoditions:must be a positive integer less than 50
*************************************************************************************/
void FindGreatestCommonDivider (int A, int B, int C, int D, int &Y, int &Z)
{
int Temp,Temp2;

while(B!= 0)
{

Temp = A % B;
A = B;
B = Temp;
}
while(D!= 0)
{

Temp2 = C % D;
C = D;
D = Temp2;
}

Y=A+C;
Z=B+D;


}
/************************************CalculateSum********************************
Description: Calculate the sum of the 2 fractions
Parameters:
IN:int, Fraction and Fraction2
OUT:int Sum of Fractions
Retuns: Nothing
Precoditions:must be a positive integer less than 50
***********************************************************************************/
void CalculateSum(int F, int F2, int & Sum)
{
Sum=F+F2;
}
/************************************EndResult********************************
Description: Displays the end result
Parameters:
IN:int, fractions
OUT:int output
Retuns: Nothing
Precoditions:must be a positive integer less than 50
*********************************************************************************/
void FindGreatestCommonDivider(int, int, int, int, int&, int&);
void CalculateSum(int, int, int&);
int EndResult(int Num,int Den,int Num2,int Den2,int SumNum,int SumDen)
{

char Ch;



cout << endl << endl;
cout << Num << " " << Num2 << " " << SumNum << endl;
cout << "--- + --- = ---"<< endl;
cout << Den << " " << Den2 << " " << SumDen;
cout << endl << endl;
cout << "------------------------------------------";
cout << "Continue? Y or N!==> ";
cin >> Ch;

return true;
}

[] Please put your code in code tags

[]State what you specifically need help on, saying you don't understand is to broad for us to help.
Topic archived. No new replies allowed.