2012-11-20 752 views

回答

11
scanf("%.2f",&x); 

,我認爲這將解決問題

1

使用

scanf("%.2f",&number); 


printf("%.2f", number);

6

的完整列表

Integer display 
%d  print as decimal integer 
%6d  print as decimal integer, at least 6 characters wide 
%f  print as floating point 
%6f  print as floating point, at least 6 characters wide 
%.2f print as floating point, 2 characters after decimal point 

隨着(在最後一項scanf("%.2f",&x);)所需的修改將解決您的問題

+0

你肯定是最後一個(%6.2f)的作品? – orustammanapov

+0

@orustammanapov我目前已將其刪除。 – Shash

相關問題