Getting errors?

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>
using namespace 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;
}
Last edited on
Try Rational r(14,-32); //Declare objects of Rational class with values on line 49.
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 &'
I think I got it actually, thanks.
Topic archived. No new replies allowed.