I can\'t get the program to get past the first line shown in main.It will read i
ID: 3613974 • Letter: I
Question
I can't get the program to get past the first line shown in main.It will read in Rational c and Rational d but get an error onRational x. In the header file are the only functions I can use.Below is my program so far. Please help.Here is main.
#include <iostream>
#include "Rational.h"
using namespace std;
int main()
{
Rational c(1, 3), d(7, 9), x;
return 0;
}
Here is the Rational.h file
#include<iostream>
#ifndef _RATIONAL_H_
#define _RATIONAL_H_
class Rational
{
public:
Rational(int Num, int Denom);
Rational(const Rational &obj);
Rational &operator=(const Rational&rhs);
bool operator==(const Rational &rhs);
bool operator>(const Rational &rhs);
bool operator<(const Rational &rhs);
Rational operator+(const Rational &rhs);
Rational &operator+=(const Rational&rhs);
Rational operator-(const Rational &rhs);
Rational &operator-=(const Rational&rhs);
Rational operator*(const Rational &rhs);
Rational &operator*=(const Rational&rhs);
Rational operator/(const Rational &rhs);
Rational &operator/=(const Rational&rhs);
operator float();
private:
int numerator;
int denominator;
int totalNumerator;
int totalDenominator;
}
#endif
Here is Rational.cpp file
#include "Rational.h"
#include<iostream>
using namespace std;
//**********************************************************
// This function stores the numerator and the denominator. *
//**********************************************************
Rational::Rational (int num, int denom)
{
numerator = num;
denominator = denom;
}
Rational::Rational(const Rational &obj)
{
numerator = 0;
denominator = 0;
}