Sprintf's statement is that
int sprintf(char *dst,const char * format_str...);
Its function is to input parameters ... import dst according to the requirements of format_str.
You need to use format_str according to the type of number.
For example, the integer (int) is used as follows
sprintf(buf," %d ",a);
If a is 123, then the string in buf is "123".
Common types of numbers are:
1 short, output band% h;;
2 long, output with %ld;
3 floating-point type, output with %f;
4 Double precision with output of %lf.