有没有办法让用户输入浮点格式说明符?例如,如果我打印这个。
float c = 15.0123
printf("%.2f", c);
// outputs: 15.01
如何将小数位数分配给变量?像:
int n = 3;
float c = 15.0123
printf("%.(%i)f", n, c);
// outputs: 15.012
有没有办法让用户输入浮点格式说明符?例如,如果我打印这个。
float c = 15.0123
printf("%.2f", c);
// outputs: 15.01
如何将小数位数分配给变量?像:
int n = 3;
float c = 15.0123
printf("%.(%i)f", n, c);
// outputs: 15.012