--- tags: DICE C --- 12-3 點食物 === > [name=CHAWTeam] --- 目錄:[DICE C語言程式破解](https://hackmd.io/@CHAWTeam/DiceC) --- 題目 --- ```! 大邑早餐店有4種食物。 選擇'A'或'a',列出牛奶 選擇'B'或'b',列出西瓜 選擇'C'或'c',列出檸檬水 其餘選項則是吐司 請寫一個程式,使得客人在選擇套餐之後,列出套餐中所含的餐點。 輸入資料: C 輸出資料: 檸檬水 ``` 程式碼 --- ```c= #include <stdio.h> int main() { char A, B, C; scanf("%c\n%c\n%c", &A, &B, &C); if (A == 'A' || A == 'a') { printf("牛奶\n"); } else if (A == 'B' || A == 'b') { printf("西瓜\n"); } else if (A == 'C' || A == 'c') { printf("檸檬水\n"); } else { printf("吐司\n"); } return 0; } ``` 輸出 --- ```! C 檸檬水 ``` --- [查看我們在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-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