I need help using the GCD Algo. in my program, I can't figure out to use the algo in my program. The algo:

```
int gcd(int a, int b){
assert(b != 0);
int rem = a % b;
while(rem !=0 ){
a = b;
b = rem;
rem = a % b;
}
return b;
```

The program:

```
#include <iostream>
using namespace std;
int Num, Num2, Denom, Denom2;
int res_up, res_down;
int Low_Value, High_Value;
char opchar,answer,symbol;
void Calculate()
{
switch (opchar) {
case '+':
res_up=(Denom2*Num) + (Denom*Num2);
res_down= Denom*Denom2;
symbol = '+';
break;
case '-':
res_up=(Denom2*Num) - (Denom*Num2);
res_down= Denom*Denom2;
symbol = '-';
break;
case '*':
res_up= Num * Num2;
res_down= Denom * Denom2;
symbol = '*';
break;
case '/':
res_up= Num * Denom2;
res_down= Denom * Num2;
symbol = '/';
break;
default: // If operator is illegal shut program down
cout << "Invalid operator." << endl;
}
}
void input()
{
cout << "Enter an operation to perform { + - / * } ";
cin >> opchar;
cout << endl;
cout << "Enter the numerator and denominator for the first fraction; include a space: ";
cin >> Num >> Denom;
cout << endl;
cout << "Enter the numerator and denominator for the second fraction; include a space: ";
cin >> Num2 >> Denom2;
cout << endl;
}
//-------------------------------------------------------------------
void output()
{
cout << "n " << Num << " " << Num2 << " " << res_up << " " << endl;
cout << "--- " << symbol << " --- = --- =n";
cout << " " << Denom << " " << Denom2 << " " << res_down << endl;
cout <<"Would you like to do another fraction? ";
cin >> answer;
cout << endl;
}
int main()
{
do
{ input();
Calculate();
output();
} while ((answer == 'y') || (answer == 'Y'));
return 0;
}
}
```