---
# System prepended metadata

title: 5-7 自主學習
tags: [DICE C]

---

---
tags: DICE C
---

5-7 自主學習
===

> [name=CHAWTeam]

---

目錄：[DICE C語言程式破解](https://hackmd.io/@CHAWTeam/DiceC)
上一篇：[5-6 時間計算](https://hackmd.io/@CHAWTeam/DiceC-5-6)
下一篇：[5_1 緞帶長度](https://hackmd.io/@CHAWTeam/DiceC-5_1)

---

題目
---

```!
寫一個程式，輸入小寫字元，然後印出其大寫。

輸入範例:
i

輸出範例:
I
```

程式碼
---

### 範例1

```c=
#include <stdio.h>
int main()
{
    char a;
    scanf("%c", &a);
    printf("%c", a-32); //英文字母大小寫差 32 個編號
    return 0;
}
```

### 範例2

```c=
#include <stdio.h>
int main()
{
    char a;
    scanf("%c", &a);
    a = a - 32; //英文字母大小寫差 32 個編號
    printf("%c", a);
    return 0;
}
```

### 範例3

```c=
#include <stdio.h>
int main()
{
    char a;
    scanf("%c", &a);
    a -= 32; //等同於「a = a - 32」
    printf("%c", a);
    return 0;
}
```

:::info
**指派運算 Assignment**
> [指派運算子會將值儲存在左運算元所指定的物件中。](https://docs.microsoft.com/zh-tw/cpp/cpp/assignment-operators?view=msvc-170)
> [name=Microsoft Docs][color=#290f91]

常見的指派運算子有`=`, `+=`, `-=`, `*=`, `/=`。
:::

輸出
---

```!
i
I
```

---

[查看我們在HackMD上的所有筆記](https://hackmd.io/@CHAWTeam)
目錄：[DICE C語言程式破解](https://hackmd.io/@CHAWTeam/DiceC)
上一篇：[5-6 時間計算](https://hackmd.io/@CHAWTeam/DiceC-5-6)
下一篇：[5_1 緞帶長度](https://hackmd.io/@CHAWTeam/DiceC-5_1)

---

{%hackmd Iiu5mOixR7yWkPHKCkabBg %}
<iframe class="LikeCoin" height="235" src="https://button.like.co/in/embed/chawteam/button?referrer=https://hackmd.io/@CHAWTeam/DiceC-5-7" width="100%"></iframe>

---

{%hackmd i1nMRrZcTFmTvoF897K9zg %}