๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

else2

ํŒŒ์ด์ฌ ์˜ˆ์™ธ์ฒ˜๋ฆฌ(Exception)์˜ ๋ชจ๋“  ๊ฒƒ ๋Œ€ํ‘œ์ ์ธ ์˜ˆ์™ธ ์ƒํ™ฉ ํ”ํžˆ ๋ฐœ์ƒํ•˜๋Š” ์˜ˆ์™ธ์ƒํ™ฉ์„ ๊ฐ„๋‹จํžˆ ์‚ดํŽด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. ์—†๋Š” ํŒŒ์ผ ์—ด๊ธฐ >>> f = open("abc.txt", 'r') Traceback (most recent call last): File "", line 1, in FileNotFoundError: [Errno 2] No such file or directory: 'abc.txt' Zero division >>> 4 / 0 Traceback (most recent call last): File "", line 1, in ZeroDivisionError: division by zero index error >>> a = [1, 2, 3] >>> a[3] Traceback (most recent call last): File "", lin.. 2023. 12. 10.
[C/C++] 3. ์กฐ๊ฑด๋ฌธ(Conditional statement) ์กฐ๊ฑด๋ฌธ(Conditional statement) ์กฐ๊ฑด๋ฌธ์€ ์ œ์–ด๋ฌธ์ด๋ผ๊ณ ๋„ ํ•˜๋ฉฐ, ์ฝ”๋“œ์˜ ํ๋ฆ„์— ๋ถ„๊ธฐ๋ฅผ ์ค„ ์ˆ˜ ์žˆ๋Š” ๊ตฌ๋ฌธ์ด๋‹ค. ํ”„๋กœ๊ทธ๋žจ์˜ ํ๋ฆ„์„ ์ œ์–ดํ•˜๊ธฐ ๋•Œ๋ฌธ์— ํ๋ฆ„ ์ œ์–ด๋ฌธ์ด๋ผ๊ณ ๋„ ํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ, ์กฐ๊ฑด์— ๋”ฐ๋ผ์„œ ์ง€์ •๋œ ์ฝ”๋“œ๋ฅผ ์ˆ˜ํ–‰ํ•œ๋‹ค. #if, else if, else condition์„ ๋‚˜ํƒ€๋‚ด๋Š” if๋ฌธ์— true, false๊ฐ€ ๋˜๋Š” ๋…ผ๋ฆฌ ๊ตฌ๋ฌธ์ด ๋“ค์–ด๊ฐ„๋‹ค. #include int var = 5; if ( var > 3 ) { std::cout 3 ) { std::cout 2021. 3. 18.