Here's the code and the error I'm having. I'm sure there are more simplified ways of writing this code but right now I just want to fix the error. Also, this code I can't test because of the error but I can tell you the goal of this function. I want it to get input of a fraction problem, i.e 1.2 - 1/4, and be able to solve it. I still need to figure out how to get rid of the space between the first fraction, the second one, and the sign operator but thats not a big issue right now. Below is my code. Please help me fix the "does not take 4 arguments" error.
// Variables for +, - parts
int newFracDen;
int newFracNum1, newFracNum2;
int finalNumerator;
// Figures out the new denominator for the fractions, provided the two denominators are not equal
if(signRead == '+')
{
newFracDen = fracDen1 * fracDen2;
newFracNum1 = fracNum1 * fracDen2;
newFracNum2 = fracNum2 * fracDen1;
finalNumerator = fractAdd(newFracNum1, newFracNum2);
}
else if(signRead == '-')
{
finalNumerator = fractSub(newFracNum1, newFracNum2);
newFracDen = fracDen1 * fracDen2;
newFracNum1 = fracNum1 * fracDen2;
newFracNum2 = fracNum2 * fracDen1;
}
else if(signRead == '*')
{
fractMult(fracNum1, fracNum2, fracDen1, fracDen2);
cout << "The fraction result is: " << newFracNum1 << "/" << newFracDen << endl;
}
else // needs work
{
fractDiv(newFracNum1, newFracNum2);
}
//////////////////////////////////////////////////////////////////////////////////////////////////
// Checks to see if the fraction is equal to 1
if(finalNumerator == newFracDen)
{
finalNumerator = 1;
cout << "The fraction result is: " << finalNumerator << endl;
}
else
{
cout << "The fraction result is: " << finalNumerator << "/" << newFracDen << endl;
}
/////////////////////////////////////////////////////////////////////////////////////////////////
}
I wouldn't spend too much time beating yourself up about it. I spent half an hour yesterday writing code, and as soon as I compiled it, I had to go back and put semicolons on the end of two of the lines. It happens to everyone, just laugh and learn.