title: question with the initialisation of my constructor (begginer question)
body: <p>for my assignment i had to do a Rational class and add the operators.
  and if the input for the denominator is 1 or the numerator is 0, output need to be just the numerator. So i wanted to initialize my copy constructor but i didn't really success (you can see i put it in comments) or maybe i need to change my print function? So if you could help me..
  thank u</p>
  
  <pre><code>//Rational.h
  #ifndef Rational_h
  #define Rational_h
  
  #include &lt;iostream&gt;
  using namespace std;
  
  class Rational{
  public:
      //default cstr
      Rational(int myNumerator=1, int myDenominator=1):numerator(myNumerator),denominator(myDenominator){}
      //copy cstr
      Rational (Rational const &amp;num):numerator(num.getNumerator()),denominator(num.getDenominator()){
          /*if (denominator==1 or numerator==0) {
             // num=numerator;
          }*/
      }
      void setNumerator(int);
      void setDenominator(int);
      int getNumerator()const;
      int getDenominator()const;
      void print();
      void reduction(int,int);
      Rational operator/(Rational);
  
  private:
      int numerator;
      int denominator;
  
  };
  
  #endif /* Rational_h */
  
  
  //  Rational.cpp
  
  void Rational::setNumerator(int myNumerator){
      numerator=myNumerator;
  }
  void Rational::setDenominator(int myDenominator){
  
      if (myDenominator==0){
          cout&lt;&lt;"ERROR"&lt;&lt;endl;
          denominator=1;
          }
      else
          denominator=myDenominator;
  }
  
  int Rational::getNumerator()const{
      return numerator;
  }
  void Rational::print(){
      cout&lt;&lt;numerator&lt;&lt;"/"&lt;&lt;denominator&lt;&lt;endl;
  }
  
  void Rational::reduction(int numerator,int denominator)
  {
    for (int i = denominator * numerator; i &gt; 1; i--)
       if ((denominator % i == 0) &amp;&amp; (numerator % i == 0)) {
           denominator /= i;
           numerator /= i;
          }
  }
  
  Rational Rational::operator/(Rational num){
      Rational newNum;
      newNum.numerator=numerator*num.denominator;
      newNum.denominator=denominator*num.numerator;
      newNum.reduction(newNum.numerator, newNum.denominator);
      return newNum;
  }
  </code></pre>