本單元語法速查表
| 寫法 | 意思 | 備註 |
|---|---|---|
scanf("%d", &n); |
讀一個 int 進 n |
變數前要 &;C 字串例外(scanf("%s", s)) |
printf("%lld %.3f\n", a, x); |
依格式輸出 | %d int、%lld long long、%c char、%s C 字串、%f double;%.3f 小數三位 |
scanf("%lf", &x); |
讀一個 double |
讀入一定是 %lf,%f 是給 float 的 |
a & b、a | b、a ^ b、~a |
逐位元 AND/OR/XOR/NOT | ^ 不是次方;單個 & 不是 && |