Your declaration for Output says it takes two doubles.
|
void Output(double num, double den)
|
When you call it, you don't pass any arguments.
|
double user_f = frac.Output();
|
The compiler does not know about any function named Output that takes no arguments.
Why are you declaring Output with two arguments? Since Output is a member of your class, Output should operate on the member variables of the class, not arguments to the function.
BTW, what happens if the user enters 0 for the denominator? Your constructor does check for a denominator of zero. If zero, it puts out a message, but the code continues on its merry way. You will get a divide by zero trap if you ever decide to convert the fraction to a number.
Your assignment statements are reversed.
1 2 3 4
|
Fraction(double Num, double Den)
{
Num = num; // num should be on the left
Den = den; // den should be on the left
|
Only the first return statement is going to be executed here. You will never reach the second return statement. Your compiler should have warned you about this.
1 2 3 4
|
double getNums()
{ return den;
return num;
}
|
PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post.
http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.