C++

'๊ฐ์ฒด ์ง€ํ–ฅ ํ”„๋กœ๊ทธ๋ž˜๋ฐ | Objecet Oriented Programming (OOP)' ์ด๋ž€ ๋ฌด์—‡์ผ๊นŒ์š”? ์ด๋ฅผ ๋” ์ž˜ ์ดํ•ดํ•˜๊ธฐ ์œ„ํ•ด์„œ, ์šฐ๋ฆฌ๊ฐ€ ๊ธฐ์กด์— ์ฃผ๋กœ ์‚ฌ์šฉํ•˜๋˜ Procedural Programming, ์ ˆ์ฐจ์  ํ”„๋กœ๊ทธ๋ž˜๋ฐ์„ ์šฐ์„  ์ดํ•ด ํ•ด ๋ด…์‹œ๋‹ค. ์ ˆ์ฐจ์  ํ”„๋กœ๊ทธ๋ž˜๋ฐ | Procedural Programming (PP) ์ ˆ์ฐจ์  ํ”„๋กœ๊ทธ๋ž˜๋ฐ์˜ ํ•ต์‹ฌ ํฌ์ธํŠธ๋Š” 'ํ•จ์ˆ˜' ์ž…๋‹ˆ๋‹ค. PP ํ”„๋กœ๊ทธ๋žจ์€ ๊ธฐ๋ณธ์ ์œผ๋กœ ํ•จ์ˆ˜์˜ ์ง‘ํ•ฉ ์ž…๋‹ˆ๋‹ค. ๋˜ํ•œ, ์šฐ๋ฆฌ๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐœ๋ณ„์ ์œผ๋กœ ์„ ์–ธํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ํ•„์š”์‹œ์— ํ•ด๋‹น ๋ฐ์ดํ„ฐ๋“ค์„ ํ•จ์ˆ˜์— ์ธ์ž๋กœ์จ ์ „๋‹ฌํ•˜์—ฌ ํ™œ์šฉํ•ฉ๋‹ˆ๋‹ค. ํ•„์š”ํ•œ ์šฉ๋„์— ๋งž์ถฐ ๊ณผ์ •์„ ๋ถ„์„ํ•˜๊ณ , ๋‚˜๋ˆ„์–ด์„œ ํ•จ์ˆ˜๋ฅผ ์„ ์–ธํ•˜๊ณ  ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์ด๊ธฐ์— ์ดํ•ดํ•˜๊ธฐ ๋งค์šฐ ์ง๊ด€์ ์ž…๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ์ ˆ์ฐจ์  ํ”„๋กœ๊ทธ๋ž˜๋ฐ์—๋Š” ๋ถ„๋ช…ํ•œ ํ•œ๊ณ„๋“ค์ด ์กด์žฌํ•ฉ๋‹ˆ๋‹ค. ๋Œ€..
ยทC++/๊ธฐํƒ€
2023.12.23 ๊ธฐ์ค€ M2 MAC ๋””๋ฒ„๊น… ๊ด€๋ จ ํŒŒ์ผ๋“ค ๊ธฐ๋ก codelldb extension ์‚ฌ์šฉ ์ค‘ //c_cpp_properties.json { "configurations": [ { "name": "Mac", "includePath": [ "${workspaceFolder}/**" ], "defines": [], "macFrameworkPath": [ "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks" ], "compilerPath": "/usr/bin/clang", "cStandard": "c17", "cppStandard": ..
string mystr = "Hello Guys!"; const char *c_mystr = mystr.c_str(); cout
C++์—์„œ ํ•จ์ˆ˜๋Š” ํฌ์ธํ„ฐ๋“ค๋„ ๋ฆฌํ„ดํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌํ•œ ํ•จ์ˆ˜๋“ค์€ type *funcion(); ์˜ ํ˜•ํƒœ๋กœ ์„ ์–ธ๋ฉ๋‹ˆ๋‹ค. ํ•œ๊ฐ€์ง€ ์ค‘์š”ํ•œ ์ ์€ '์ ˆ๋Œ€๋กœ ํ•จ์ˆ˜ ๋‚ด์˜ ๋กœ์ปฌ ๋ณ€์ˆ˜๋ฅผ ๋ฆฌํ„ดํ•˜์ง€ ์•Š๋Š”๋‹ค.' ์ž…๋‹ˆ๋‹ค. ๊ฐ„๋‹จํ•œ ์˜ˆ์‹œ ์ฝ”๋“œ๋ฅผ ์‚ดํŽด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. int *largest_int(int *int_ptr1, int *int_ptr2){ if (*int_ptr1 > *int_ptr2) return int_ptr1; else return int_ptr2; } ๋‘๊ฐœ์˜ ์ •์ˆ˜ ํฌ์ธํ„ฐ๋ฅผ ๋น„๊ตํ•˜์—ฌ ๋” ํฐ ๊ฐ’์˜ ์ •์ˆ˜์˜ ํฌ์ธํ„ฐ๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. ์ด ํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ฉ”์ธ ํ•จ์ˆ˜์˜ ์˜ˆ์‹œ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. int main() { int a {30}; int b {40}; int *largest_ptr{nullptr}; largest_p..
Chan Lee
'C++' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก (6 Page)