별의 공부 블로그 🧑🏻‍💻

🗒️ Programming (298)

728x90
  1. 2020.03.24 리스트 내포(List Comprehension)

    *리스트 내포(List Comprehension) # 리스트 내포(List Comprehension)a = [1, 2, 3, 4]result = []for num in a: result.append(num * 3)print(result) # [3, 6, 9, 12] a = [1, 2, 3, 4]result = [num * 3 for num in a] # 리스트 내포(List Comprehension)print(result) # [3, 6, 9, 12] # 리스트 안에 for, if문 포함하기a = [1, 2, 3, 4]result = [num * 3 for num in a if num % 2 == 0]print(result) # [6, 12] 리스트 안에 for문이나 if문을 포함하여 간단하게 리스트를 ..

  2. 2020.03.12 비트 연산자(Bitwise Operator)

    *비트 연산자(Bitwise Operator) 연산자 예 설명 &10 & 5 AND 연산 : 모두 참(1)일 경우만 참(1) | 10 | 5 OR 연산 : 둘 중 하나만 참(1)일 경우 참(1) ^ 10 ^ 5 XOR 연산 : 모두 다를 경우만 참(1) > 2 오른쪽 비트 이동 연산 # 비트 연산자 ''' & : AND 비트 연산 | : OR 비트 연산 ^ : XOR 비트 연산 : 왼쪽 피연산자의 비트를 오른쪽으로 이동''' print(10&5) # 0print(10|5) # 15print(10^5) # 15print(102) # 2 ''' 풀이 bin(10) : 0b1010 bin(5) : 0b101 (1) &(AND) 10: 1010 5 : 0101 --------- 0000(2) -> 0(10) (..

  3. 2019.05.06 Dynamic Memory (동적 메모리)

    Static & Dynamic Memory To be successful as a C++ programmer, it's essential to have a good understanding of how dynamic memory works. In a C++ program, memory is divided into two parts: The stack: All of your local variables take up memory from the stack. The heap: Unused program memory that can be used when the program runs to dynamically allocate the memory. Many times, you are not aware in a..

  4. 2019.05.06 Pointers (포인터)

    Pointers Every variable is a memory location, which has its address defined. That address can be accessed using the ampersand (&) operator (also called the address-of operator), which denotes an address in memory. For example:int score = 5; cout

  5. 2019.05.06 Naming Rules for Variables (변수 이름 생성 규칙)

    *Naming Rules for Variables (변수 이름 생성 규칙) The names of variables in the C++ language are referred to as identifiers. The best naming convention is to choose a variable name that will tell the reader of the program what the variable represents. Variables that describe the data stored at that particular memory location are called mnemonic variables. Rules for naming variables: (1) Variable names i..

  6. 2018.11.17 sort 함수 정렬 기준

    std::sortdefault (1)template void sort (RandomAccessIterator first, RandomAccessIterator last); custom (2)template void sort (RandomAccessIterator first, RandomAccessIterator last, Compare comp);Sort elements in rangeSorts the elements in the range [first,last) into ascending order. The elements are compared using operator b.length(); // 내림차순 정렬 } int main(){ string ip[N]; int num; cin >> num; c..

  7. 2018.10.07 랜덤 함수/난수 생성 함수 (Random Function)

    123456789101112131415161718192021#include #include // rand()#include // time()using namespace std; int main() { int MAX, RANGE; cout MAX; cout RANGE; cout

  8. 2018.09.24 입력된 문자열에서 공백을 제거하여 출력하기

    공백 없애기 문제의 입력값은 각 언어의 표준입력(stdin) 함수를, 출력값은 표준출력(stdout) 함수를 사용해주세요.이 문제는 입력된 문자열에서 공백을 제거하여 출력하는 프로그램을 작성하는 것 입니다.예를 들어 "This is Kim !" 가 입력 되었다면 "ThisisKim!"가 출력되도록 하면 되는 것 입니다. 입력50자 이내의 문장출력입력에서 공백이 제거된 문장 ( 입출력 예시 참고 ) 입/출력 예시⋇ 입출력 형식을 잘 지켜주세요.␣ : 공백↵ : 줄바꿈−⇥ : 탭보기 입력 1I ␣am ␣Goorm ␣!Hello World !출력 1IamGoorm!HelloWorld! 보기 입력 2This ␣is ␣SpartaNice to meet you출력 2ThisisSpartaNicetomeetyou 입..

  9. 2018.02.23 10 jQuery Global Map Plugins

    In this post we are sharing with you a collection of 10 jQuery Global Map plugins that you’ll definitely find useful if you want to display global maps on your site. A collection of jQuery interactive maps and image maps of world or specific country/location. These map plugins no not require Flash. Just JavaScript. Sweet. Enjoy =)Related Posts:10 jQuery Google Maps Plugins1. JQVMapA jQuery plugi..

  10. 2017.11.26 Pair Vector

    *Pair Vector - 벡터 안에 두 쌍의 데이터를 넣는 방법.- 벡터 선언 : vector 벡터명- 벡터에 데이터 삽입 : 벡터명.push_back(std::make_pair(데이터1, 데이터2))- 코드 사용 예123456789101112131415161718#include #include #define N 500000using namespace std; int main(){ long long int n, a, b, area, ary[N]; vector vec; // 벡터 선언 scanf("%lld", &n); for (int i = 0; i

  11. 2017.11.17 [header][container] queue : priority_queue

    *[header][container] queue : priority_queue std::priority_queuetemplate class priority_queue;Priority queuePriority queues are a type of container adaptors, specifically designed such that its first element is always the greatest of the elements it contains, according to some strict weak ordering criterion. This context is similar to a heap, where elements can be inserted at any moment, and only..

  12. 2017.11.17 [header][container] queue : queue

    *[header][container] queue : queue std::queuetemplate class queue;FIFO queuequeues are a type of container adaptor, specifically designed to operate in a FIFO context (first-in first-out), where elements are inserted into one end of the container and extracted from the other. queues are implemented as containers adaptors, which are classes that use an encapsulated object of a specific container ..

  13. 2017.11.15 string형 변수 길이 구하기

    *string형 변수 길이 구하기 - (string형 변수).length()를 길이를 나타내는 변수에 대입해준다.- 예)123string base = "hello world!"; base.length(); base.size();cs - size()와 length()는 이름만 다를 뿐, 같은 일을 하는 멤버 함수다.- 내용 출처 : http://makerj.tistory.com/127#string-길이

  14. 2017.11.12 vector 안의 원소들의 순서를 역순으로 바꾸는 방법

    *vector 안의 원소들의 순서를 역순으로 바꾸는 방법 1) 헤더를 include하여 reverse 함수를 사용한다.12345678#include #include int main() { std::vector a; std::reverse(a.begin(), a.end()); return 0;}Colored by Color Scriptercs 2) rbegin()과 rend()를 사용한다.12345678910111213141516171819#include #include templatevoid print_range(InIt first, InIt last, char const* delim = "\n"){ --last; for(; first != last; ++first){ std::cout

  15. 2017.11.08 정렬 알고리즘의 시간 복잡도 비교

    Array Sorting Algorithms AlgorithmTime ComplexitySpace ComplexityBestAverageWorstWorstQuicksortΩ(n log(n))Θ(n log(n))O(n^2)O(log(n))MergesortΩ(n log(n))Θ(n log(n))O(n log(n))O(n)TimsortΩ(n)Θ(n log(n))O(n log(n))O(n)HeapsortΩ(n log(n))Θ(n log(n))O(n log(n))O(1)Bubble SortΩ(n)Θ(n^2)O(n^2)O(1)Insertion SortΩ(n)Θ(n^2)O(n^2)O(1)Selection SortΩ(n^2)Θ(n^2)O(n^2)O(1)Tree SortΩ(n log(n))Θ(n log(n))O(n^2)..

  16. 2017.11.08 데이터 형식 범위

    데이터 형식 범위Visual Studio 2015 게시 날짜: 2016년 6월Visual Studio 2017 에 대한 최신 설명서는 Visual Studio 2017 설명서를 참조하세요.Visual C++ 32비트 및 64비트 컴파일러는 이 문서의 뒷부분의 표에 나온 형식을 인식합니다.int (unsigned``int)__int8 (unsigned``__int8)__int16 (unsigned``__int16)__int32 (unsigned``__int32)__int64 (unsigned``__int64)short (unsigned``short)long (unsigned``long)long long (unsigned``long``long)이름이 두 개의 밑줄(__)로 시작하는 경우 데이터 형식은 비표준..

  17. 2017.11.08 [header][C library] cwctype (wctype.h)

    *[header][C library] cwctype (wctype.h) (wctype.h)Wide character typeThis header declares a set of functions to classify and transform individual wide characters. For more info on how the standard ASCII character set is classified using the "C" locale, see . FunctionsCharacter classification functionsThey check whether the character passed as parameter belongs to a certain category: iswalnumChec..

  18. 2017.11.08 [header][C library] cwchar (wchar.h)

    *[header][C library] cwchar (wchar.h) (wchar.h)Wide charactersThis header file defines several functions to work with C wide strings. FunctionsInput/Output: (mostly wide versions of functions) fgetwcGet wide character from stream (function )fgetwsGet wide string from stream (function )fputwcWrite wide character to stream (function )fputwsWrite wide string to stream (function )fwideStream orienta..

  19. 2017.11.08 [header][C library] cuchar (uchar.h) (C++11)

    *[header][C library] cuchar (uchar.h) (C++11) (uchar.h)Unicode charactersThis header provides support for 16-bit and 32-bit characters, suitable to be encoded using UTF-16 and UTF-32. TypesIn C, this header defines two macros: char16_t and char32_t, which map to unsigned integral types of the appropriate size (the same as uint_least16_t and uint_least32_t, respectively). In C++, char16_t and cha..

  20. 2017.11.08 [header][C library] ctime (time.h)

    *[header][C library] ctime (time.h) (time.h)C Time LibraryThis header file contains definitions of functions to get and manipulate date and time information. FunctionsTime manipulationclockClock program (function )difftimeReturn difference between two times (function )mktimeConvert tm structure to time_t (function )timeGet current time (function ) ConversionasctimeConvert tm structure to string ..

  21. 2017.11.08 [header][C library] ctgmath (tgmath.h) (C++11)

    *[header][C library] ctgmath (tgmath.h) (C++11) (tgmath.h)Type-generic mathCC++This header defines macro functions that correspond to the functions in , but which can take other non-floating point types as arguments: Every function in that takes at least one double as argument (except modf) is defined in as a macro with the same semantics but taking generic parameters instead: Each of the argume..

  22. 2017.11.08 [header][C library] cstring (string.h)

    *[header][C library] cstring (string.h) (string.h)C StringsThis header file defines several functions to manipulate C strings and arrays. FunctionsCopying: memcpyCopy block of memory (function )memmoveMove block of memory (function )strcpyCopy string (function )strncpyCopy characters from string (function ) Concatenation: strcatConcatenate strings (function )strncatAppend characters from string ..

  23. 2017.11.08 [header][C library] cstdlib (stdlib.h)

    *[header][C library] cstdlib (stdlib.h) (stdlib.h)C Standard General Utilities LibraryThis header defines several general purpose functions, including dynamic memory management, random number generation, communication with the environment, integer arithmetics, searching, sorting and converting. FunctionsString conversionatofConvert string to double (function )atoiConvert string to integer (funct..

  24. 2017.11.08 [header][C library] cstdio (stdio.h)

    *[header][C library] cstdio (stdio.h) (stdio.h)C library to perform Input/Output operationsInput and Output operations can also be performed in C++ using the C Standard Input and Output Library (cstdio, known as stdio.h in the C language). This library uses what are called streams to operate with physical devices such as keyboards, printers, terminals or with any other type of files supported by..

  25. 2017.11.08 [header][C library] cstdint (stdint.h) (C++11)

    *[header][C library] cstdint (stdint.h) (C++11) (stdint.h)Integer typesThis header defines a set of integral type aliases with specific width requirements, along with macros specifying their limits and macro functions to create values of these types. TypesThe following are typedefs of fundamental integral types or extended integral types. signed typeunsigned typedescriptionintmax_tuintmax_tInteg..

  26. 2017.11.08 [header][C library] cstddef (stddef.h)

    *[header][C library] cstddef (stddef.h) (stddef.h)C Standard definitionsThis header defines several types implicitly generated or used by certain language expressions. Typesptrdiff_tResult of pointer subtraction (type )size_tUnsigned integral type (type )max_align_t Type with widest scalar alignment (type )nullptr_t Null pointer type (C++) (type ) In C, this header also includes the declaration ..

  27. 2017.11.08 [header][C library] cstdbool (stdbool.h) (C++11)

    *[header][C library] cstdbool (stdbool.h) (C++11) (stdbool.h)Boolean typeThe purpose in C of this header is to add a bool type and the true and false values as macro definitions. In C++, which supports those directly, the header simply contains a macro that can be used to check if the type is supported: Macro constants Macrodescriptiondefined as__bool_true_false_are_definedSpecifies whether bool..

  28. 2017.11.08 [header][C library] cstdarg (stdarg.h)

    *[header][C library] cstdarg (stdarg.h) (stdarg.h)Variable arguments handlingThis header defines macros to access the individual arguments of a list of unnamed arguments whose number and types are not known to the called function. A function may accept a varying number of additional arguments without corresponding parameter declarations by including a comma and three dots (,...) after its regula..

  29. 2017.11.08 [header][C library] csignal (signal.h)

    *[header][C library] csignal (signal.h) (signal.h)C library to handle signalsSome running environments use signals to inform running processes of certain events. These events may be related to errors performed by the program code, like a wrong arithmetical operation or to exceptional situations, such as a request to interrupt the program. Signals generally represent situations where the program ..

  30. 2017.11.08 [header][C library] csetjmp (setjmp.h)

    *[header][C library] csetjmp (setjmp.h) (setjmp.h)Non local jumpsThe tools provided through this header file allow the programmer to bypass the normal function call and return discipline, by providing the means to perform jumps preserving the calling environment. The header provides, a function, a macro with functional form and a specific type: FunctionslongjmpLong jump (function ) Macro functio..

728x90


📖 Contents 📖