Can anyone help with this error?

Here's what I have:
1 #include <iostream>
2 #include <cmath>
3
4 using namespace std;
5
6
7 class Fraction{
8 private:
9 int numerator;
10 int denominator;
11 int findCommonDivisor(int num1, int num2);
12 public:
13 void setNumerator(int newNumerator);
14 void setDenominator(int newDenominator);
15 double getAsDouble();
16 void outputLowest();
17
18 };
19
20
21 void Fraction::setNumerator(int newNumerator){
22 numerator = newNumerator;
23 }
24
25 void Fraction::setDenominator(int newDenominator){
26 denominator = newDenominator;
27 }
28
29 double Fraction::getAsDouble(){
30 return static_cast<double>(numerator)/denominator;
31 }
32
33 void Fraction::outputLowest(){
34 int gcd;
35 gcd = findCommonDivisor(numerator, denominator);
36 cout << (numerator/ gcd) << endl;
37 }
38
39 int Fraction::findCommonDivisor(int num1, int num2){
40 for(int i=num2; i>0; i--){
41 if ((num2 % i)==0) && ((num1 % i)==0)
42 return i;
43 }
44 }
45
46
47
48 int main(){
49 Fraction f1;
50
51 double n;
52 double d;
53
54 cout << "Enter a numerator: " << endl;
55 cin >> n;
56 cout << "Enter a denominator: " << endl;
57 cin >> d;
58
59 f1.setNumerator(n);
60 f1.setDenominator(d);
61
62 cout << f1.getAsDouble() << endl;
63
64 f1.outputLowest();
65
66
67 return 0;
68
69 }

Errors:

41: error: expected identifier before â(â token
41: error: expected â;â before â(â token

Thanks!! :)
Put parentheses around whole condition:
`if ( ((num2 % i)==0) && ((num1 % i)==0) )`
Thank you!! I don't know why I didn't figure that out... so obvious! lol. Thanks again!
Topic archived. No new replies allowed.