fork download
  1.  
  2. #include <iostream>
  3. using namespace std;
  4.  
  5.  
  6. class fraction
  7. {
  8. fraction(int initNumerator, int initDenominator);
  9. fraction();
  10. int numerator;
  11. int denominator;
  12. };
  13.  
  14. // Constructors
  15. fraction::fraction(){
  16. numerator = 0;
  17. denominator = 1;
  18. }
  19.  
  20. fraction::fraction(int initNumerator, int initDenominator){
  21. if(initDenominator == 0){
  22. std::cout<<"Denominator can not be zero"<<std::endl;
  23. exit(0);
  24. }
  25. numerator = initNumerator;
  26. denominator = initDenominator;
  27. }
  28.  
  29. int main()
  30. {
  31. return 0;
  32.  
  33. }
Success #stdin #stdout 0s 4444KB
stdin
Standard input is empty
stdout
Standard output is empty