|
![]() |
Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming > Application Programming | |
Passing argument discont. qualifiers error
|
||
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) | ||||||||||||
|
New to Overclock.net
|
This is the part of the code that gets the error:
__________________rational rational::add(const rational q) const {int d1=q.get_denominator(); int denom= denominator; int f=greatest_common_divisor(denom,d1); int g=q.get_denominator()/f; int h=denom/f; int n=g*numerator + h*q.get_numerator(); int d=g*denom; rational r(n,d); r.lowest_terms(); return r;} when it passes an argument through "greatest common divisor" during compiling, I get the error in the add function: int rational::greatest_common_divisor(int a ,int b) { if(b<0) {b=-b;} if(a<0) {a=-a;} if(a==0) {return(b);} else if(b==0) {return(a);} // a = b*q + r int q, r; q = a/b; r = a%b; return greatest_common_divisor(b,r);} Any help would be great. Thanks!
|
||||||||||||
|
|
|
|
|
#2 (permalink) | |||||||||||||
|
Programmer
|
I greatly advise proper formatting if you want help.
__________________
|
|||||||||||||
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|