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

Green frog - '97 A4 Avant 1.9TDI 81kW
90 day: 39.92 mpg (US)
Thanks: 5
Thanked 11 Times in 9 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