--- tags: DICE C --- 12-2 點套餐 === > [name=CHAWTeam] 目錄:[DICE C語言程式破解](https://hackmd.io/@CHAWTeam/DiceC) 題目 --- ```! 大邑早餐店有三種套餐。 選擇'A',列出牛奶、西瓜、檸檬水與吐司 選擇'B',列出西瓜、檸檬水與吐司 選擇'C',列出檸檬水與吐司 請寫一個程式,使得客人在選擇套餐之後,列出套餐中所含的餐點。 輸入資料: B 輸出資料: 西瓜 檸檬水 吐司 ``` 程式碼 --- ```c= #include <stdio.h> int main() { char x; scanf("%c", &x); if (x == 'A') printf("牛奶\n西瓜\n檸檬水\n吐司"); else if (x == 'B') printf("西瓜\n檸檬水\n吐司"); else if (x == 'C') printf("檸檬水\n吐司"); return 0; } ``` 輸出 --- ```! B 西瓜 檸檬水吐司 ``` --- [查看我們在HackMD上的所有筆記](https://hackmd.io/@CHAWTeam) 目錄:[DICE C語言程式破解](https://hackmd.io/@CHAWTeam/DiceC) --- {%hackmd Iiu5mOixR7yWkPHKCkabBg %} <iframe class="LikeCoin" height="235" src="https://button.like.co/in/embed/chawteam/button?referrer=https://hackmd.io/@CHAWTeam/DiceC-12-2" 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