add the way to specify number of decimal places (#31925)
* add the way to specify number of decimal places * add comma and period
This commit is contained in:
committed by
Jingyi Ding
parent
86641b4ad7
commit
be96a8808f
@ -84,6 +84,10 @@ int main() { float a = 0.0; scanf(“%f”,&a); //输入是45.65 p
|
|||||||
|
|
||||||
字符串输入:%s
|
字符串输入:%s
|
||||||
|
|
||||||
|
可以设定要放多少个小数点:
|
||||||
|
%.2f 代表只会显示两个小数点。
|
||||||
|
但只可以放在 printf()里,不能在scanf()里。
|
||||||
|
|
||||||
# 包括
|
# 包括
|
||||||
|
|
||||||
int main() { char str \[20\]; scanf(“%s”,str); //输入是nitesh printf(“%s \\ n”,str); 返回0; }
|
int main() { char str \[20\]; scanf(“%s”,str); //输入是nitesh printf(“%s \\ n”,str); 返回0; }
|
||||||
|
Reference in New Issue
Block a user