Thanks for the response. I was in a total re-write when my computer went down. I am trying to multiply random fractions then reduce them. I have added my new code. I can not seem to pass the random numerators and denominators to cout.

Code:
#include <iostream>
#include <ctime>
using namespace std;

class Fraction
{
   private:
            int num; // Numerator
            int den; // Denominator

    public:
            int num2;
            int den2;            
            double setNumerator() {return num;} //sets numerator
            double setDenominator() {return den;} //sets Denominator
            double setNumerator2() {return num2;} //sets numerator 2
            double setDenominator2() {return den2;} //sets Denominator 2
            int Reduce(); //will reduce the fraction to lowest terms
            void print(); //will print the fraction in the form: numerator / denominator
            /int rand(); //will create random fractions
            void Result(); //will multiply the fractions
            Fraction(); // constructor
            Fraction(int,int); // 2 Argument Constructor
            //int Fract1();
            
};

Fraction::Fraction()
   {
     num=0;
     den=1;
   }

Fraction::Fraction(int n,int d)
   {
     num=n;
     den=(d==0)? 1 :d;
     
   }
   
double setNumerator (int num)
{
    
    srand ( time(NULL) );
    num = rand() % 9 + 1;

    return num;    
}

double setDenominator (int den)
{
    
    srand ( time(NULL) );
    den = rand() % 9 + 1;

    return den;    
}

double setNumerator2 (int num2)
{
    
    srand ( time(NULL) );
    num2 = rand() % 9 + 1;

    return num2;    
}

double setDenominator2 (int den2)
{
    
    srand ( time(NULL) );
    den2 = rand() % 9 + 1;

    return den2;    
}


//Fract2.setNumerator(rand() % 9 + 1); 

//Fract2.setDenominator(rand() % 9 + 1); 

//Result.setDenominator(Fract1.getDenominator() * Fract2.getDenominator());

void Result(int &num, int &den, int &num2, int &den2)          
{
        int calcnum;  
        int calcden;        
        calcnum = num * num2;      
        calcden = den * den2;         
}
  
int Reduce(int a, int b)
{

    int calcden = a; 
    int calcnum = b;
    
    if(b == 0)
    {
            return a;
    }
    else
    {
        return Reduce(b, a % b);
    }
}

void print(int &num, int &den)
{
        cout << "The reduced and added fraction is " << num << "/" << den << endl;
}

int main()
{
   int num = 0, den = 0, num2 = 0, den2 = 0;
   int calcnum = 0;
   int calcden = 0;
   int a = 0;
   int b = 0;
   int m = 0;
   int n = 0;
   //int i;
   //int rand ();
   //cout << "What is << num << "/" << den << "*" <<num2 << "/" << den2<< "?" << endl;
   cout << "What is" << num<< "/" << den<< "*" << num2<<"/"<<den2<<"?"<<endl; 
   cout << "enter numerator / denominator" << "  " << "Your answer must be in reduced form" << endl;
   cin >> num >> den;
   //Result(num, den, num2, den2); 
   Reduce(a, b);
   print(num, den);
   cout << endl;
      
    return(0);
}

Last edited by shabbir; 19Feb2010 at 10:03.. Reason: Code blocks