-
error calling function
O.K. I have a program that finds the solution to addding, subtracting, dividing or multiplying a fractions. My problem occurs when I try to find the Greatest common factor. I have the Greatest common factor funtion declared in the class as:
int dogcf(int, int)
In the int main I have it as:
dogcf(int, int);
And in the header for the function i have it as:
int dogcf(int num, int den);
num and den are the numerator and denominator of the problem. When I try to compile it I get an error message that reaads as follows:
fractions3.cpp: In function `int main()':
fractions3.cpp:37: parse error before `,'
What do I have to do to the calling of it in int main() to fix this problem? If anyone knows I would appreciate some help.
Thanks. Kyle
-
Code:
int main()
{
int num, den;
cout << "Enter numerator and demoninator:";
cin >> num >> den;
cout << "Greatest common factor:" << dogcf(num, den) << endl;
return 0;
}
or you could just say:
int gcf;
gcf = dogcf(3, 5);
-
Where's that spell checker?
cout << "Enter numerator and denominator:";
-
Thanks for the help. It did not work but the attempt was appreciated. I just turned in the assignment by writing gcf right in the int main. If anyone has any ideas on what was wrong i would appreciate it since finals are next week and there may be something like that on it.
Thanks again, Kyle