--- tags: DICE C --- 12-1 字元 === > [name=CHAWTeam] --- 目錄:[DICE C語言程式破解](https://hackmd.io/@CHAWTeam/DiceC) --- 題目 --- ```! 有一種選擇, 選A會有一種結果的結果, 選B會有選擇另一種的結果, 以此類推。 這種選擇常會用到字元 該如何輸入一個字元,再印出呢? 輸入資料: G 輸出資料: G C範例程式: #include <stdio.h> int main(){ char ch; scanf(......); printf(......); return 0; } C++範例程式: #include <iostream> int main(){ char ch; std::cin>>ch; std::cout<<ch; return 0; } ``` 程式碼 --- ```c= #include <stdio.h> int main() { char ch; scanf("%c", &ch); printf("%c", ch); return 0; } ``` 輸出 --- ```! G G ``` --- [查看我們在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-1" 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