View Single Post
Old 11-09-2009, 08:18 PM   #2 (permalink)
meelis11
EcoModding Apprentice
 
meelis11's Avatar
 
Join Date: Feb 2009
Location: Estonia
Posts: 199

Green frog - '97 Audi A4 Avant 1.9TDI 81kW
Diesel
90 day: 43.1 mpg (US)
Thanks: 19
Thanked 40 Times in 28 Posts
Hey,
if you define function prototype with default value, then you can call function normally when 2 decimal places is needed:

Quote:
char* format(long num, byte maxdec=2){
//...
}

//calling function
a = format(b); //2 decimal places
a = format(b, 1); //1 decimal places
a = format(b, 0); //0 decimal places = integer
  Reply With Quote