Hi all. I have been working on a program to add fractions. I want to eventually +, -, *, and / fractions. When I run it all I can do is enter two fractions and nothing else happens. If you have the time I would appreciate any and all help.

Here is the problem:

Write a function that reads a problem involving two common fractions (such as 2/4 + 5/6). After reading, call a function to perform the indicated operation (just adding right now). Pass the numerator and denominator of both fractions to the func that performs the operation (should return num and denom of result through its output parameters). Then display the result as a common fraction.

I have these guidelines:

--foundation: a = bq + r

--1. find gcd of num & denom

2. divid num & denom by gcd

3. use the lcm

--1. divide lcm by denom (multiplier)

2. multiply num & denom by multiplier

3. add num storing in num accumulator

4. copy lcm into denom of accumulator

Code:

--In bold is what I have as guidelines and code

--Also, there are specific questions included as comments

I'm still a beginner so.... Thank you for any help :)Code:

#include<iostream>

#include<cmath>

using namespace std;

void getFraction(int&, int&);

void readFracProblem(int&, int&, int&, int&, char&); //For later use with +,-,*,/

void add(int&, int&, int, int, int);//I added the last "int" for my program

int gcd(int, int);, int

int lcm(int, int);//I added the last "int" for program

void normalizeFraction(int&, int&);, gcdNumber;

void displayFraction(int, int);

int main(){

int n1, d1, n2, d2

cout << "Enter a fraction (n / d): ";

getFraction(n1, d1);

cout << "Enter a fraction (n / d): ";

getFraction(n2, d2);

gcdNumber = gcd(d1, d2);

add(n1, d1, n2, d2, gcdNumber);

displayFraction(n1, d1);

return 0;

}

void getFraction(int& n, int& d){

char slash; //Should it be "char = slash;" ?

cin >> n >> slash >> d;

}

int lcm(int accD, int d, int gcd){

int lcm;

lcm = (accD * d) / gcd;

return lcm;

}

void add(int& accN, int& accD, int n, int d, int gcd){

int lcmNumber = lcm(accD, d, gcd); //*I'm not sure where these should go

int multiplier = lcmNumber / accD; //*

accN = accN * multiplier; //*

multiplier = lcmNumber / d; //*

n = n * multiplier; //*

accN = accN + n; //*

accD = lcmNumber; //*I'm not sure where these should go

}

int gcd(int a, int b){

int remainder, gcdNumber;

do{

remainder = a % b;

gcdNumber = a / b;

}while(remainder != 0);

return gcdNumber;

}

void normalizeFraction(int& n, int& d){

if(d < 0){

d = -d;

n = -n;

}

int absN = abs(n);

int gcdNumber = gcd(absN, d);

n = n / gcdNumber;

d = d / gcdNumber;

}

void displayFraction(int n, int d){

normalizeFraction(n, d); //Does this belong here?

cout << n << " / " << d << endl;

}