C++/๊ธฐํƒ€

ยทC++/๊ธฐํƒ€
lhs op= rhs ์˜ ๋ฐฉ์‹์œผ๋กœ ์ž‘๋™ํ•œ๋‹ค. ex) cost += item * tax // cost = cost + (item * tax)
ยทC++/๊ธฐํƒ€
C++์—์„œ boolean๊ฐ’์„ ๊ธฐ๋ณธ์ ์œผ๋กœ 1 for true, 0 for false๋กœ ์ถœ๋ ฅ๋œ๋‹ค. ํ•˜์ง€๋งŒ, true/false๋กœ ์ถœ๋ ฅ๋˜๋Š” ๊ฒƒ์ด ๋”์šฑ ์œ ์šฉํ•œ ๊ฒฝ์šฐ๋„ ๋งŽ๋‹ค. ์ด๋Ÿด ๋•Œ, ์ฝ”๋“œ์— cout
ยทC++/๊ธฐํƒ€
C++์—์„œ ์ •์ˆ˜๋ผ๋ฆฌ ๋‚˜๋ˆ—์…ˆ์„ ํ•˜๊ฒŒ ๋˜๋ฉด, ์†Œ์ˆ˜์  ์ดํ•˜์˜ ์ˆซ์ž๋Š” ๋ฒ„๋ ค์ง‘๋‹ˆ๋‹ค. #include using namespace std; int main(){ int num1 = 10; int num2 = 3; float result = num1 / num2; cout
ยทC++/๊ธฐํƒ€
์ฆ๊ฐ ์—ฐ์‚ฐ์ž๋Š” ๋Œ€์ƒ ๊ฐ’์„ 1์”ฉ ์ฆ๊ฐ€ ํ˜น์€ ๊ฐ์†Œ์‹œํ‚ต๋‹ˆ๋‹ค. (variable++: variable = variable + 1) (variable--: variable = variable - 1) ๋กœ ์ดํ•ดํ•˜๋ฉด ์ข‹์Šต๋‹ˆ๋‹ค. ์ฆ๊ฐ ์—ฐ์‚ฐ์ž๋Š” ์ •์ˆ˜, ์‹ค์ˆ˜, ํฌ์ธํ„ฐ ๋ณ€์ˆ˜์—์„œ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. ์ฆ๊ฐ ์—ฐ์‚ฐ์ž์—๋Š” ๋‘๊ฐ€์ง€ notation์ด ์žˆ์Šต๋‹ˆ๋‹ค. Prefix notation: ++num Postfix notation: num++ ๊ฐ๊ฐ ์ฆ๊ฐ ์—ฐ์‚ฐ์„ statement ์ด์ „์— ์ ์šฉํ•  ์ง€, statement ์‹คํ–‰ ์ดํ›„์— ์ ์šฉํ• ์ง€๋ฅผ ๊ฒฐ์ •ํ•ฉ๋‹ˆ๋‹ค. // ์ฆ๊ฐ ์—ฐ์‚ฐ์ž ์‚ฌ์šฉ ์˜ˆ์‹œ #include using namespace std; int main(){ int counter {10}; cout
Chan Lee
'C++/๊ธฐํƒ€' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก (3 Page)