전체 글 201

[C++] 클래스 기초 예제

대략적인 클래스 #include #include #include // 네임스페이스 using namespace std; // 글자 색상, 배경 색상 변경 void tbColor(unsigned short textColor = 7, unsigned short backColor = 0) { int color = textColor + backColor * 16; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), color); } // ======================================================================================= // // 클래스 생성 class Person { // 접근제어자는 3..

공부/C & C++ 2022.01.14

[C / C++] 콘솔 글씨 색상 변경

#include #include // 글씨색 변경을 위해선 windows.h 헤더 파일이 필요함 // color #define BLACK 0 #define BLUE 1 #define GREEN 2 #define CYAN 3 #define RED 4 #define MAGENTA 5 #define BROWN 6 #define LIGHTGRAY 7 #define DARKGRAY 8 #define LIGHTBLUE 9 #define LIGHTGREEN 10 #define LIGHTCYAN 11 #define LIGHTRED 12 #define LIGHTMAGENTA 13 #define YELLOW 14 #define WHITE 15 void tbColor(unsigned short textColor = 7, u..

프로그래밍 강좌

[파이썬] 입문 강좌 https://programmers.co.kr/learn/courses/2 파이썬 입문 ### 수료증 발급 관련 현재 수료증 관련 요청이 폭증하고 있습니다. 프로그래머스는 특별한 경우를 제외하고는 **무료 강의** 에 대해 수료증을 발급하지 않고 있습니다. 증빙용 수료증이 필요하 programmers.co.kr [C언어] 입문 강좌 http://edu.goorm.io/learn/lecture/201/%EB%B0%94%EB%A1%9C-%EC%8B%A4%ED%96%89%ED%95%B4%EB%B3%B4%EB%A9%B4%EC%84%9C-%EB%B0%B0%EC%9A%B0%EB%8A%94-c%EC%96%B8%EC%96%B4 한 눈에 끝내는 C언어 기초 - 구름EDU 이미 모두 갖추어진 실습환경..

[C언어] 간단한 가위바위보

#include #include #include int main(void) { srand(time(NULL)); int input, comInput; int win = 0, draw = 0, lose = 0; char * arr[] = {"가위", "바위", "보"}; while(1) { printf("가위[1] , 바위[2] , 보[3] 중 하나를 입력해주세요, 종료[0]\n"); printf("입력 :: "); scanf("%d", &input); printf("\n"); if(input == 0) { printf(">> 가위바위보 종료\n"); printf("\n===== [ 결과 ] =====\n"); printf("승 : %d / 무승부 : %d / 패배 : %d", win, draw, lose..

[C언어] 선택 정렬

선택 정렬(Selection Sort) 알고리즘 이란 #include // 9, 6, 7, 3, 5 > 초기값 // 3, 6, 7, 9, 5 > 1회 // 3, 5, 7, 9, 6> 2회 // 3, 5, 6, 9, 7> 3회 // 3, 5, 6, 7, 9> 4회 // 배열의 처음 부터 끝까지 탐색 -> 최솟값 탐색 // 찾은 최솟값은 첫번째 위치에 배정시킵니다. // 배정이 끝났으면 두번째 위치부터 탐색 시작. // 위와 같은 방법으로 n-1번 반복 void SelectionSort(int arr[], int n) { int i, j, k; int temp, minIdx; for(i = 0; i < (n - 1); i++) { minIdx = i; printf("[%d 번] ", i); for(j = 0..

공부/C & C++ 2022.01.06