# Week 1 ###### tags: `C++` ## The Hello World Program ```cpp #include <iostream> using namespace std; int main() { cout << "Hello, World!\n"; } ``` ### 大括號 {} * 代表群組 * 表示函式的開始與結束 * main() Function ### include iostream * 把標準資料流的宣告式包含進來 * cout: 標準輸出流 * std: 命名空間 * using namespace std ## 基礎語法 ### 變數宣告 * int, long long, double, string * 不能用保留字 ### if else ### loops ### 陣列 * 宣告大小後不能改變 * 上限:2*10^6 #### 陣列遍歷 ```cpp int a[5] = {0, 1, 1, 2, 3}; for(int i = 0; i < 5; i++) { cout << a[i] << ' '; } ``` ## AC了,然後? * 回頭看,怎麼寫會更好實做 * 如何解決Bug