getting an error within my code fro c++ and cannot figure outhow to resolve. what I am trying to do is Use exceptions so thatyour program handles the exceptions division by zero and invalidinput. codes are the following; fractiontype.h #pragma once
#include using namespace std; //the class for fractions which is dervied from the exceptionclass
class fractionException : public exception
   const char *msg;
   fractionException(const char *m) :msg(m) {}
   virtual const char *what() const throw()
       return msg;
}; //this is the class defintion for fraction
class fractionType
   int n;
   int d;
   fractionType() : n(0), d(1) {}
   fractionType(int num, int den) : n(num), d(den)
       if (den == 0)
           throwfractionException(“Division by zero”);//this gives the zeroexception
   }    fractionType operator/(const fractionType&x);
   friend ostream & operator
   friend istream& operator>>(istream &in,fractionType &f);
//End Fraction Header MainProgram.cpp #include
#include “fractionType.h”//this is the import
using namespace std; int main()
   try {        fractionType num1(1,0) ;        fractionType num2(0,3) ;        fractionTypenum3;        cout
   return 0;
//main end FractionType.cpp #include “fractionType.h”
int main()
   std::ostream& operator
       return os
   }    std::istream &operator>>(std::istream& is, fractionType & frac)
       is >> frac.n;
       is >> frac.d;
       return is;
   }    fractionType operator/(fractionType const &a,fractionType const &b)
       if (a.d == 0 || b.d == 0) throwfractionException(“Division by zero”);
       return fractionType{ (a.n * b.n) /(a.d * b.d) };
   } } Attached

"Get 15% discount on your first 3 orders with us"
Use the following coupon

Order Now