Output with digit after comma

Hi,
sorry, my first day.. like to show variable with comma

here what i have (and work)
int progress=0;
sprite.drawString(String(progress)+"%",75,54);
sample output 22 %

I would like to show one digit after the comma
sample output 2.2 %

Please let me know your advise, thanks

Integers have no fractional part.

progress is an integer. Do you mean that if it was 324 you want to display 32.4 and so forth?

  progress / 10 

woukd give you 32, and

  progress % 10

would yield 4, in the example of 324.

You have to print those two numbers and print your own decimal point (or comma in some places around the world) in between them.

a7

Hi,

This is exactly what i'm looking for

Thanks a lot

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.