--- tags: DICE C --- 4-3 浮點數 === > [name=CHAWTeam] [time=Feb 16, 2022] --- 目錄:[DICE C語言程式破解](https://hackmd.io/@CHAWTeam/DiceC) 上一篇:[4-2 倒序](https://hackmd.io/@CHAWTeam/DiceC-4-2) 下一篇:[4-4 3個浮點數](https://hackmd.io/@CHAWTeam/DiceC-4-4) --- 題目 --- ```! 寫一個程式,輸入一個浮點數,然後印出該浮點數。 輸入範例: 5.6 輸出範例: 5.600000 提醒使用C++的學習者,必須特別指定小數點後6位,寫法提示如下,詳細說明請看簡報 #include<iostream> #include<iomanip> using namespace std; int main() { float num; cin>>num; cout<<fixed<<setprecision(6)<<num; return 0; } ``` ### 提示 ![提示](https://i.imgur.com/SZ8VeEi.png) 程式碼 --- ```c= #include <stdio.h> int main() { float num; scanf("%f", &num); printf("%f", num); return 0; } ``` 輸出 --- ```! 5 6 5.000000 ``` --- [查看我們在HackMD上的所有筆記](https://hackmd.io/@CHAWTeam) 目錄:[DICE C語言程式破解](https://hackmd.io/@CHAWTeam/DiceC) 上一篇:[4-2 倒序](https://hackmd.io/@CHAWTeam/DiceC-4-2) 下一篇:[4-4 3個浮點數](https://hackmd.io/@CHAWTeam/DiceC-4-4) --- {%hackmd Iiu5mOixR7yWkPHKCkabBg %} <iframe class="LikeCoin" height="235" src="https://button.like.co/in/embed/chawteam/button?referrer=https://hackmd.io/@CHAWTeam/DiceC-4-3" width="100%"></iframe> --- {%hackmd i1nMRrZcTFmTvoF897K9zg %}
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up