본문 바로가기

C++

(11)
아스키코드와 유니코드 부호화란?문자를 컴퓨터에 저장하기 위해서는 문자를 부호화해야 한다.예를 들어, 문자 'a'를 아스키코드로 부호화하면 0x61이 된다. 아스키코드1960년대 미국에서 정의한 표준 부호 체계7비트만을 사용, 1비트는 에러 검출용 parity bitSingle Byte Character Set(SBCS)0~127의 값을 가짐7비트밖에 사용하지 않기에 한글과 같은 다른 언어를 표현하기에는 부족 ➡️ ANSI 코드의 등장유니코드1991년대 최초 발표된 표준 부호 체계Wide Byte Character Set(WBCS)UTF-8, UTF-16, UTF-32 등 다양한 인코딩 방식이 있으며, 가장 널리 사용되는 것은 UTF-8.UTF-81~4바이트를 사용.Grapheme ➡️ Code Point ➡️ BytesGra..
프로그래밍 언어의 종류 세상에는 수많은 프로그래밍 언어가 있다. 프로그래밍 언어는 크게 2가지 기준에 따라 분류될 수 있다. Compiled Languages vs Interpreted Languages Compiled language는 compiling을 통해 CPU가 이해할 수 있는 machine code로 된 executable을 생성한다. 예시 C, Haskell Interpreted language는 interpreter가 사용자가 작성한 코드를 동적으로 CPU가 이해할 수 있는 코드로 변환한다. 물론, interpreted language도 compile될 수는 있지만 interpreter를 함께 동봉해야 한다. 예시 : Java, Python Imperative Languages vs Functional Langu..
Data types Alternate name size minimum value maximum value byte UInt8 1 byte 0 255 singed byte Int8 1 byte -128 127 unsigned short UInt16 2 bytes 0 65535 short Int16 2 bytes -32768 32767 unsigned integer UInt32 4 bytes 0 4,294,967,295 integer Int32 4 bytes -2,147,483,648 2,147,483,647 unsigned long UInt64 8 bytes 0 18quintillion long Int64 8 bytes -9 quintillion 9 quintillion string - variable n/a n/a char..
C++ 주석 쓰는 법 /* To generate a random item, we're going to do the following: * 1) Put all of the items of the desired rarity on a list * 2) Calculate a probability for each item based on level and weight factor * 3) Choose a random number * 4) Figure out which item that random number corresponds to * 5) Return the appropriate item */ C++에서 주석은 // 또는 /*, */를 이용해 다음과 같이 쓸 수 있다. // your comment goes here /* This..
C++ Standard Library란 #include 우리가 C++ 프로그래밍할 때 자주 쓰는 구문이다. 이것은 C++ Standard Library인데 C++ Standard Library의 정의는 바로 다음과 같다. Collection of precompiled code that has been “packaged up” for reuse in other programs. The C++ Standard Library is a library that ships with C++. It contains additional functionality to use in your programs.
build, clean, rebuild, compile, run/start build, clean, rebuild, compile, run/start의 차이 Build compiles all modified code files in the project or workspace/solution, and then links the object files into an executable. If no code files have been modified since the last build, this option does nothing. 즉, build = compile + link Clean removes all cached objects and executables so the next time the project is built, all files will be recompi..
What is Project and Workspace(or Solution)? What is a Project? Project = container that holds my source code files, images, data files, etc.... that are needed to produce an executable(or library, website, etc...) that can be run or used. Also contains various compilers, linker settings, or IDE configurations. Generally, project is IDE specific. Therefore, 1 project = 1 program. What is a Console Project? Console Project = Project that is..
C++ IDE 설치하기 IDE란? Integrated Development Environment의 약자로 개발, 빌드, 디버깅을 할 수 있는 프로그램. 추천하는 Compiler * 최소 C++17은 지원하는 compiler - GCC/G++ 7 - Clang++ 8 - Visual Studio 2017 15.7 Visual Studio에서 C++ 개발하기 윈도우 10/11 사용자에게는 Visual Studio 2022 Community를 추천한다. 링크 : https://visualstudio.microsoft.com/downloads/ Download Visual Studio Tools - Install Free for Windows, Mac, Linux Download Visual Studio IDE or VS Code f..
C, C++ 개발 workflow 많은 개발자들이 간과하는 부분이다. 하지만 workflow를 지켜야 효율적인 개발이 가능하다. Workflow는 다음과 같다. Step 1. Define the problem to solve. Step 2. Design a solution. Step 3. Write a program that implements the solution. Step 4. Compile the program. Step 5. Link object files and libraries. Step 6. Test program. Step 7. Debug. Go back to Step 4. Step 1. Define the problem to solve. 예시 "나는 사용자에게 여러 숫자를 입력 받고 숫자들의 합을 출력하는 프로그램을 작..
C, C++의 철학과 역사 C와 C++의 철학 : "trust the programmer" - C와 C++은 프로그래머에게 엄청난 자유도를 부여한다. - C와 C++ 프로그래밍 시 해야할 것과 하지말아야 할 것을 잘 지켜야 한다. - 강점 : high performance, precise control over memory and other resources - Application : video games, real-time systems, high-performance, graphical applications and simulations, embedded software... 등 C의 역사 - developed by Dennis Ritchie at Bell labs in 1972. - systems programming la..