### 通知事項 11/10/2023 ### 1. 複習時間 ## ![baller](https://hackmd.io/_uploads/S1QqL1i7p.png) ## 請寫一個struct給baller,它包含了血量、dodgeball數量、球的傷害 :::spoiler **P1答案** ``` struct baller { int hp, dodgeball_count, ball_dmg; }; ``` }; ::: *** ### 2. 複習(hard) ## 請寫出一個把字串的字母,大寫改成小寫、小寫改成大寫的程式 ## eg. hELLo ---> HellO ## Hint: 用 ASCII :::spoiler **P2答案** ``` #include <iostream> #include <string> int main() { std::string str; std::cin >> str; for (int i=0; i<str.length(); i++) { if ((int)str[i] > 90) str[i] = str[i] - 32; else str[i] = str[i] + 32; } std::cout << str; } ``` ::: ***