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;
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)
{