westwest
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # 景資30第一學期C++社課編排 ## 課程編排 第一學期六堂社課 預計從介紹C++教到一維陣列 課程安排: | 第一堂9/16 | 第二堂10/21 | 第三堂10/28 | 第四堂11/18| 第五堂12/02 | 第六堂12/30 | | --- | --- | --- | -------- | -------- | -------- | | 破冰遊戲/選課 |DC介紹(40)/起手式|if else| 迴圈 | 一維陣列 | 成發 | | 起手式|輸入輸出/運算子|迴圈| 一維陣列 | 總複習/成發討論 | 成發 | **** ## 課程詳細內容 ### **1. 起手式/輸入輸出** 學妹們先背起來==起手式==(跟學姊一樣x 輸入輸出==cin cout 注意箭頭方向== ```cpp= #include<iostream> using namespace std; int main(){ cin>>(內容);//輸入 cout<<(內容);//輸出 } ``` 1.每行除了有大括號之外,都==需要在句尾加上分號== 2.所有在括號後面還有內容的句法都需要加入大括號 **練習題目** a033: hello, world ### **2. 變數/四則運算** ==算數運算子:== | + | - | * | / | % | | ---- | ---- | ---- | ---- | ----------- | | 加法 | 減法 | 乘法 | 除法 | 模 計算餘數 | ==邏輯運算子:== | && | 兩條直線 | == | != | | ---- | -------- | --- | --- | | A和B | A或B | 等於 | 不等於 | ==變數:== | int | float | char | string | bool | | ---- | ----- | ---- | ------ | --- | | 整數 | 小數 | 字元 | 字串 | 布林值 | int: 負責存取整數變數 float: 負責存取小數變數 char: 存取字元, 字元指==單個字符== 如'A' '+' 'b' string : 字串,==指單字== 如 "apple" "happy" **練習題目** a014: 中華民國萬歲! b001: 小學生的三角形面積計算 b002: BMI值計算機 b005: 高中生的三角形面積與周長 ```cpp= #include<iostream> using namespace std; int main(){ int a = 1,b = 2; //創立變數 cout<<a+b;//輸出A+B的數 cout<<a-b;//輸出A-B的數 cout<<a*b;//輸出A+B的數 cout<<a/b;//輸出A-B的數 } ``` 變數的名稱不能是c++當中擁有的功能 思考一下: cout<<A+B;和cout<<"A+B";會有甚麼差別? ### **3. if else** ==if else:== | if | else if | else | | -------- | -------- | -------- | | 如果...則... | 否則如果...則... | 否則 | if用於==第一個==的條件/==首要==的條件 else if用於當==上一個條件不符合==而這項條件符合所做的抉擇 else 當所有條件==皆不符合==時做的抉擇 **練習題目** b007: 你過胖了嗎 b008: 決戰520 b011: 我想要學分嗚嗚 b028: 恭喜你可以參加複試 b029: 大雨大雨一直下 ### **4. 迴圈** 迴圈有for跟while兩種,差別在於for有一定的==起始和結尾值==,while則沒有固定結尾值 寫while時要小心==無限迴圈== ==for:== ```cpp= #include<iostream> using namespace std; int main(){ int a, x = 100; for(int i = 0; i<x; i++){ cin>>a; if(a == 1) cout<<"a == 1"<<endl; else cout<<"a != 1"<<endl; } } ``` 思考一下: = 和 == 的差別是什麼? 由上面舉例,i從0開始使跑,直到==99(x-1)停下==,==共跑100次== 若i從1開始,則會跑到99,==共跑99次== ==while:== ```cpp= #include<iostream> using namespace std; int main(){ int a; while(cin>>a){ if(a == 1) cout<<"a == 1"<<endl; else cout<<"a != 1"<<endl; } } ``` while沒有起始和結尾值, 而是==有規則==,當遇到規則以外的事就會跳出迴圈 **練習題目** b030: 一百次我愛你 a038: 我不說髒話 b032: 小朋友學數數 a011: 加減乘除 ### **5. 一維陣列** 一維陣列通常==和迴圈一起使用==, 陣列當中的內容==輸入輸出需要用迴圈==, 不可直接cout>>陣列 陣列的==格數從0開始數==, 陣列第一格是a[0],第二格是a[1],第三格是a[2],以此類推 ==輸入:== ```cpp= #include<iostream> using namespace std; int main(){ int a[100];//建立一個名叫a的100格一維陣列存放int for(int i = 0; i<100; i++){//從第1格跑到第99格共100格 cin>>a[i]; } } ``` ==輸出:== ```cpp= #include<iostream> using namespace std; int main(){ int a[100];//建立一個名叫a的100格一維陣列存放int for(int i = 0; i<100; i++){//從第1格跑到第99格共100格 cin>>a[i]; } for(int i = 0; i<100; i++){ cout<<a[i]; } } ``` **** ## 小社課編排 | 11/08 | 11/15 | 12/06 | 12/13 | 12/20 | 12/27 | 01/03 | | --------- | ------------ | ------------- | ------------ | ----------------- | --------------- | ---------- | | 刷if else | 教while+刷迴圈 | 刷一維陣列 | 刷題競賽 | 刷題競賽(做成發) | 製作專題成發 | 成發優化 | | 詳解解析 | 詳解解析 | 題目講解 | 題目講解 | 題目講解 | 製作專題成發 | 成發優化 | **** ## 百題題庫 題目共有100題,加油! 寫完就超過學姊了! | | 題號 | | 提示 | | | --- | ---- | ---------------------------------------------------------------------------------- | --------------------------------------------------------------- |:--- | | 1 | a033 | [hello,world](https://jmj.cmgsh.tp.edu.tw/ShowProblem?problemid=a033) | 基本輸入輸出,簡單拉 | | | 2 | a032 | [班際籃球賽](https://jmj.cmgsh.tp.edu.tw/ShowProblem?problemid=a032) | 不要被題目騙了!相信自己超簡單 | | | 3 | a014 | [中華民國萬歲!](https://jmj.cmgsh.tp.edu.tw/ShowProblem?problemid=a014) | 挖嗚是水題 咕嚕咕嚕 | | | 4 | b001 | [小學生的三角形面積計算](http://jmj.cmgsh.tp.edu.tw/ShowProblem?problemid=b001) | 輸入可能有小數 | | | 5 | b005 | [高中生的三角形面積與周長](https://jmj.cmgsh.tp.edu.tw/ShowProblem?problemid=b005) | 引入<math.h>函式庫 開根號要用sqrt(數); | | | 6 | a042 | [買鉛筆](http://jmj.cmgsh.tp.edu.tw/ShowProblem?problemid=a042) | 除12的整數用一打,模12的餘數用一根 | | | 7 | b002 | [BMI值計算機](http://jmj.cmgsh.tp.edu.tw/ShowProblem?problemid=b002) | 注意單位還有身高體重不要除錯位置 | | | 8 | b007 | [你過胖了嗎 ](http://jmj.cmgsh.tp.edu.tw/ShowProblem?problemid=b007) | <=、< 要判斷清楚 | | | 9 | b008 | [決戰520 ](http://jmj.cmgsh.tp.edu.tw/ShowProblem?problemid=b008) | 把每種出拳情況都列出來寫if else | | | 10 | b011 | [我想要學分嗚嗚 ](http://jmj.cmgsh.tp.edu.tw/ShowProblem?problemid=b011) | 簡單簡單, 喝水題 | | | 11 | a019 | [0 與 1](http://jmj.cmgsh.tp.edu.tw/ShowProblem?problemid=a019) | 咕嚕咕嚕 | | | 12 | a012 | [Johnny B.Goode](http://jmj.cmgsh.tp.edu.tw/ShowProblem?problemid=a012) | 用string變數輸入名字 | | | 13 | a007 | [K-I-S-S-I-N-G](http://jmj.cmgsh.tp.edu.tw/ShowProblem?problemid=a007) | 跟a012一樣概念,咕嚕咕嚕 | | | 14 | a020 | [ㄑㄧˊ 數?](http://jmj.cmgsh.tp.edu.tw/ShowProblem?problemid=a020) | 咕嚕咕嚕 | | | 15 | a015 | [妳那裡現在幾點了?](http://jmj.cmgsh.tp.edu.tw/ShowProblem?problemid=a015) | 輸入若小於15需要換日 | | | 16 | b028 | [恭喜你可以參加複試](http://jmj.cmgsh.tp.edu.tw/ShowProblem?problemid=b028) | 繼續水題,沒甚麼好講 | | | 17 | b029 | [大雨大雨一直下](http://jmj.cmgsh.tp.edu.tw/ShowProblem?problemid=b029) | 降雨量為零要輸出無降雨 | | | 18 | a017 | [BASIC 的 SGN 函數](http://jmj.cmgsh.tp.edu.tw/ShowProblem?problemid=a017) | 寫不出來學姊笑你! | | | 19 | b025 | [小華買午餐](http://jmj.cmgsh.tp.edu.tw/ShowProblem?problemid=b025) | 小華對午餐要求很多 | | | 20 | b026 | [午餐要不要配飲料](http://jmj.cmgsh.tp.edu.tw/ShowProblem?problemid=b026) | 暑假銜接課程時,我超級討厭小華 | | | 21 | b027 | [午餐的抉擇](http://jmj.cmgsh.tp.edu.tw/ShowProblem?problemid=b027) | 學姊很希望小華不吃午餐餓死 | | | 22 | b035 | [發糖果囉](http://jmj.cmgsh.tp.edu.tw/ShowProblem?problemid=b035) | 善用模來運算 | | | 23 | a031 | [山六九之旅](http://jmj.cmgsh.tp.edu.tw/ShowProblem?problemid=a031) | 劍湖山 六福村 九族文化村 | | | 24 | b030 | [一百次我愛你](https://jmj.cmgsh.tp.edu.tw/ShowProblem?problemid=b030) | 我愛你我愛你我愛你我愛.... | | | 25 | a038 | [我不說髒話](https://jmj.cmgsh.tp.edu.tw/ShowProblem?problemid=a038) | 我不說髒話 不說髒話 說髒話 髒話 髒 | | | 26 | b019 | [誰是學霸](https://jmj.cmgsh.tp.edu.tw/ShowProblem?problemid=019) | 新增一變數,第一個數存入, 當輸入的下一個數大於上一個數時取代它 | | | 27 | | | | | | 28 | a078 | [我討厭偶數](http://jmj.cmgsh.tp.edu.tw/ShowProblem?problemid=a078) | 使用while迴圈不斷除直到不是偶數 | | | 29 | | | | | | 30 | b017 | [找因數](http://jmj.cmgsh.tp.edu.tw/ShowProblem?problemid=b017) | 從一開始算到自己本身, 能被整除的就是因數 | | | 31 | b018 | [韓信點兵](http://jmj.cmgsh.tp.edu.tw/ShowProblem?problemid=b018) | 跟找因數同樣概念,只是有三個規則用&&連接 | | | 32 | b022 | [成績公布](http://jmj.cmgsh.tp.edu.tw/ShowProblem?problemid=b022) | 一號同學是陣列的第零格位置 | | | 33 | a075 | [烤肉節奏](https://jmj.cmgsh.tp.edu.tw/ShowProblem?problemid=a075) | | | | 34 | a071 | [這就是我們之間的差距!](https://jmj.cmgsh.tp.edu.tw/ShowProblem?problemid=a071) | | | | 35 | | | | | | 36 | | | | | | 37 | | | | | | 38 | | | | | | 39 | | | | | | 40 | | | | | | 41 | | | | | | 42 | | | | | | 43 | | | | | | 44 | | | | | | 45 | | | | | | 46 | | | | |

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    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

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully