string to_string (int val);string to_string (long val);string to_string (long long val);string to_string (unsigned val);string to_string (unsigned long val);string to_string (unsigned long long val);string to_string (float val);string to_string (double val);string to_string (long double val);
type of val | printf equivalent | description |
---|---|---|
int | "%d" | Decimal-base representation of val. The representations of negative values are preceded with a minus sign (-). |
long | "%ld | |
long long | "%lld | |
unsigned | "%u" | Decimal-base representation of val. |
unsigned long | "%lu | |
unsigned long long | "%llu | |
float | "%f" | As many digits are written as needed to represent the integral part, followed by the decimal-point character and six decimal digits. inf (or infinity) is used to represent infinity. nan (followed by an optional sequence of characters) to represent NaNs (Not-a-Number). The representations of negative values are preceded with a minus sign (-). |
double | "%f | |
long double | "%Lf |
|
|
pi is 3.141593 28 is a perfect number |