need help with fractions in C++

I need to make fractions to be in the simplest form. how to do it .i know i need to call and pass fraction to gcd and simplify but i dont now how to do it so it will work..

Code:

int divide()

{

int one4,two4,three4,four4;

int e4,f4;

cout<<"Input the nominator and denominator of a fraction separated by spaces :"<<endl;

cin>>one4;

cin>>two4;

cout<<"Input the nominator and denominator of a fraction separated by spaces :"<<endl;

cin>>three4;

cin>>four4;

cout<<"Input instruction/_" << endl;

e4 = one4*four4;

f4 = two4*three4;

cout<<"("<< one4 << "/"<< two4 <<") / ("<< three4 <<"/"<< four4 <<") = " << e4 << "/" << f4;

cout << "\n";

return 0;

}

void simplify(int x2 , int y2 ,int gcd )

{

int a;

int b;

cout<< "Input the nominator and denomiantor of a fraction separated by spaces :" << x2 <<" "<< y2 << endl;

a= x2/gcd;

b= y2/gcd;

cout<<"This fraction equals ("<< a <<"/"<< b << ")"<< endl;

}

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;

}

void input()

{

int x,y,k;

cout << "Enter first integer: ";

cin >> x;

cout << "Enter second integer: ";

cin >> y;

k=gcd(x,y) ;

cout <<"GCD is "<< k << endl;

simplify( x , y , k); //calls

}