Usage of %f and form

Can anyone tell me why we use Form and %f in root?

When you need to include a number into a character string.
Do you have a particular example where you need explanations ?

Hi Manisha,

I am not sure I understand your question as it is quite generic. Form allows you to create strings from a template in which you can insert values from other variables. %f denotes that you would like to insert the information of a floating point number. You can as well select how many digits to display:

root [0] float number(1.23456);
root [1] result1 = Form("The number is %.4f", number);
root [2] result1
(char *) "The number is 1.2346"
root [3] result2 = Form("The number is %.2f", number);
root [4] result2
(char *) "The number is 1.23"

You have the same formatting options as for printf: