Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Application Programming › Passing argument discont. qualifiers error
New Posts  All Forums:Forum Nav:

Passing argument discont. qualifiers error

post #1 of 2
Thread Starter 
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!
true love
(13 items)
 
  
CPUMotherboardGraphicsRAM
Conroe e6300 OC 3.23 ghz Asus P5B nVidia 7950 gt ko 512mb 579/1710 mhz OCZ Gold DDR2 800 512mbx2 + 1gbx2 
Hard DriveOSMonitorKeyboard
WD 160GB SATA x2 Windows XP SP2 Sony 19&quot; Logitech 
PowerMouse
Generic 550W+Antec 500W Logitech mx 700 
  hide details  
Reply
true love
(13 items)
 
  
CPUMotherboardGraphicsRAM
Conroe e6300 OC 3.23 ghz Asus P5B nVidia 7950 gt ko 512mb 579/1710 mhz OCZ Gold DDR2 800 512mbx2 + 1gbx2 
Hard DriveOSMonitorKeyboard
WD 160GB SATA x2 Windows XP SP2 Sony 19&quot; Logitech 
PowerMouse
Generic 550W+Antec 500W Logitech mx 700 
  hide details  
Reply
post #2 of 2
I greatly advise proper formatting if you want help.
Lee XT
(17 items)
 
  
CPUMotherboardGraphicsRAM
AMD FX-6300 Asus M5A97 SAPPHIRE Radeon HD 7850 AMD 4GB DDR3 1333MHZ 
RAMRAMRAMHard Drive
AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ OCZ Vertex 4 256GB 
CoolingOSMonitorKeyboard
Corsair H80 Windows 8.1 Pro MCE Dell P2414H WHXV7  Microsoft Generic 
PowerCaseMouseMouse Pad
Ultra 600W Limited Edition NZXT Black Steel Razer Deathadder Razer Goliath 
Audio
Realtek HD Audio 
  hide details  
Reply
Lee XT
(17 items)
 
  
CPUMotherboardGraphicsRAM
AMD FX-6300 Asus M5A97 SAPPHIRE Radeon HD 7850 AMD 4GB DDR3 1333MHZ 
RAMRAMRAMHard Drive
AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ OCZ Vertex 4 256GB 
CoolingOSMonitorKeyboard
Corsair H80 Windows 8.1 Pro MCE Dell P2414H WHXV7  Microsoft Generic 
PowerCaseMouseMouse Pad
Ultra 600W Limited Edition NZXT Black Steel Razer Deathadder Razer Goliath 
Audio
Realtek HD Audio 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Application Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Application Programming › Passing argument discont. qualifiers error