### A-取餘數大作戰 http://120.101.182.21/d/hd112/p/P7 ### B-Two_digits http://120.101.182.21/d/hd112/p/28 ### C-school_desk http://120.101.182.21/d/hd112/p/29 ### D-Ascending digits http://120.101.182.21/d/hd112/p/38 ### E-Same-color http://120.101.182.21/d/hd112/p/35 # 提示 ## 基本架勢 ### 程序代碼 ```cpp #include <bits/stdc++.h> // 引入所有標準庫 using namespace std; // 省略 std:: 的使用 int main() { //程式打在這裡 return 0; // 程序正常結束 } ``` ## 基本輸入 (`cin`) 我們使用 `cin` 來,把這些資料存到變數中。語法很簡單:`cin >> 變數名;` ### 範例: ```cpp int a; //先定義一個變數a cin >> a; // 讀入一個整數 ``` ## 基本輸出 (`cout`) 我們使用 `cout` 來將變數的內容輸出。語法:`cout << 變數名;` ### 範例: ```cpp cout << a; // 輸出變數 a 的值 (5) ``` ## 邏輯判斷(`if`) 我們使用`if`來做出**如果⋯就⋯**的句型 像是如果a比5大就執行程式,要這樣寫 ``` if(a > 5){ //程式在這邊 } ``` ### 範例 : ``` if (條件式) { //程式在這邊 } ``` # [前幾節課的講義連結](https://hackmd.io/@KmGhOo8ZRwqiTc0v_9dKFA/rynkXUPgJx/%2F%40KmGhOo8ZRwqiTc0v_9dKFA%2FSJAuNoCTC) ---
×
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