I'm getting two errors:
1) IntelliSense: no instance of constructor "Rational::Rational" matches the argument list argument types are: (int)
2)'Rational::Rational(const Rational &)' : cannot convert parameter 1 from 'int' to 'const Rational &'
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
//Program to reduce rational numbers
#include<iostream>
usingnamespace std;
//Rational class defintion
class Rational
{
private:
int num, denom; //member var.
public:
Rational(int aval, int bval); //constructor
double reduce(); //function to reduce rational number
friend ostream & operator<<(ostream & out, Rational&r); //overloaded stream output operator
};
stem("pause");
return 0;
}
ok that helped, but the other error, I'm not sure how to fix:
Error 1 error C2664: 'Rational::Rational(const Rational &)' : cannot convert parameter 1 from 'int' to 'const Rational &'