SOLVED Adding up ints on label

Started by Slasher, Thu 15/09/2022 18:30:30

Previous topic - Next topic

Slasher

Would someone please remind me of adding up ints and show on one label (total from 4 ints).

Code: ags
 LMoney.Text=String.Format("%d",Willis_Bank,  Meyers_Bank,  Mercer_Bank,  Guthrie_Bank);


Cheers

EDIT Think I'v done it...
Code: ags
LMoney.Text=String.Format("%d",Willis_Bank +  Meyers_Bank +  Mercer_Bank +  Guthrie_Bank);




Crimson Wizard

Do you need to display four ints one by one or display a sum of 4 ints?

Slasher

Quote from: Crimson Wizard on Thu 15/09/2022 19:30:42
Do you need to display four ints one by one or display a sum of 4 ints?

Each int gets displayed on it's own Label one by one. The main label displays them as the occur and adds them up on the fly.

Crimson Wizard

Quote from: Slasher on Thu 15/09/2022 19:48:39
Each int gets displayed on it's own Label one by one. The main label displays them as the occur and adds them up on the fly.

If one by one, then you need to have as many %d as you have ints:

Code: ags

LMoney.Text=String.Format("%d, %d, %d, %d", Willis_Bank,  Meyers_Bank,  Mercer_Bank,  Guthrie_Bank);

SMF spam blocked by CleanTalk