Pythone 입문기
-
C++ 하루코딩
[C++] 문자열 포인터 사용해보기
#include #include using namespace std;void C_Input(char* str, int size) { char ch; int i = 0; while (i
-
C++ IDE를 위한 과정
C++ 문자열 포인터
문자열 포인터의 개념과 활용방법을 같이 학습해 봅시다.문자열 포인터 종류string str1 = "codingon";C++ 표준 라이브러리의 std::string 클래스다양한 메서드(.length(), .substr(), .append() 등)를 통해 문자열 조작이 편리char str2[] = "codingon";char 배열에 null-terminated 문자열('\0')로 저장메모리에 할당된 배열의 크기는 고정적이며, 문자열의 내용을 변경할 수는 있지만 크기를 조정할 수 없음char str3[] = {'c', 'o', 'd', 'i', 'n', 'g', 'o', 'n'};문장 배열일 뿐 문자열로 간주되지 않음인덱싱 가능char* str4 = "helloworld";문자열 리터럴*에 대한 포인터(cha..
-
C++ 하루코딩
[C++] 동적으로 배열 할당 후 입력하기
이것은 해답 예시일뿐 정답은 이것만 있는 것이 아닙니다.구조체로도 해보시고 함수로만으로도 해보시고 클래스를 다른 방식으로 사용해 보시길 바랍니다.#include using namespace std;class Array{private: int *arr; int size; int capacity; //배열 확장 void Expand_Array(){ capacity += 2; int *new_arr = new int[capacity]; for(int i = 0; i 0){ int remove_element = arr[--size]; cout > capacity; Array arr(capacity); cout 0) { ..
-
C++ 하루코딩
[C++] 문자열 포인터 사용해보기
#include #include using namespace std;void C_Input(char* str, int size) { char ch; int i = 0; while (i
-
C++ IDE를 위한 과정
C++ 문자열 포인터
문자열 포인터의 개념과 활용방법을 같이 학습해 봅시다.문자열 포인터 종류string str1 = "codingon";C++ 표준 라이브러리의 std::string 클래스다양한 메서드(.length(), .substr(), .append() 등)를 통해 문자열 조작이 편리char str2[] = "codingon";char 배열에 null-terminated 문자열('\0')로 저장메모리에 할당된 배열의 크기는 고정적이며, 문자열의 내용을 변경할 수는 있지만 크기를 조정할 수 없음char str3[] = {'c', 'o', 'd', 'i', 'n', 'g', 'o', 'n'};문장 배열일 뿐 문자열로 간주되지 않음인덱싱 가능char* str4 = "helloworld";문자열 리터럴*에 대한 포인터(cha..
-
C++ 하루코딩
[C++] 동적으로 배열 할당 후 입력하기
이것은 해답 예시일뿐 정답은 이것만 있는 것이 아닙니다.구조체로도 해보시고 함수로만으로도 해보시고 클래스를 다른 방식으로 사용해 보시길 바랍니다.#include using namespace std;class Array{private: int *arr; int size; int capacity; //배열 확장 void Expand_Array(){ capacity += 2; int *new_arr = new int[capacity]; for(int i = 0; i 0){ int remove_element = arr[--size]; cout > capacity; Array arr(capacity); cout 0) { ..