C언어 기초
-
C언어로 만든 간단한 행맨 게임C언어 기초/C언어 연습 2021. 11. 6. 01:27
/* * 행맨 게임 * 2021-11-06 */ #include #include #include #include #include /* * Define */ #define HANGMAN 20 #define ANSWER_WIDTH 70 #define MAX 1000 /* * 함수 선언 */ // 커서 이동 함수 void gotoxy(int x, int y); // 기본 배경(처형대, 밑줄 등) 출력 함수 void Background(); // 답 입력받기 void Answer(); // 행맨 몸 관리 함수 void Body(int* bodyCount); // 글자 대조 함수 int Compare(char take); // 글자 맞췄을 때 함수 void Correct(int len_ptr, char take)..
-
C언어 공룡 점프 게임C언어 기초/C언어 연습 2021. 8. 31. 02:28
C언어 공룡 점프 게임 /* 공룡게임 * z 누르면 점프 * 공룡 발 번갈아 가면서 출력 * 장애물 생성 * 충돌 처리 */ // 헤더 #include #include #include #include #include #define DINO_BOTTOM_Y 12 #define TREE_BOTTOM_Y 20 #define TREE_BOTTOM_X 45 // 함수 선언 void SetConsoleView(); bool isCollision(const int treeX, const int dinoY); void GotoXY(int x, int y); int GetKeyDown(); void DrawDino(int dinoY); void DrawTree(int treeX); void DrawGameOver(con..
-
C언어로 만든 간단한 온라인 은행 프로그램C언어 기초/C언어 연습 2021. 8. 30. 00:07
입출금, 계좌 계설, 잔액 조회 기능을 가진 은행 프로그램 #define _CRT_SECURE_NO_WARNINGS #include #include #include #include #define SIZE 19 /* 사용자 구조체 관리 */ struct Bank_User { char name[20]; char account[20]; int balance; }; /* 구조체 초기화 */ struct Bank_User BUser[10] = { {"None", "None", 0}, {"None", "None", 0}, {"None", "None", 0}, {"None", "None", 0}, {"None", "None", 0}, {"None", "None", 0}, {"None", "None", 0}, {"No..
-
C언어 함수 정리C언어 기초/C언어 함수 정리 2021. 8. 26. 21:00
C언어를 공부하며 배운 함수를 정리합니다. #include getch() 사용방법: 변수 = getch(); 1바이트의 크기로 입력된 키보드의 아스키코드값을 반환하기 때문에 2바이트 크기의 키보드 값(ex. 방향키)들은 함수를 두 번 입력하면 됨 아무 키나 입력받을 때: getch(); 만 사용 가능 _kbhit() 사용방법: _kbhit(); _keyboardhit() 키보드를 누르면 0이 아닌 값 반환, 누르지 않으면 0 반환 #include bool 사용방법: bool 변수이름 = flase 또는 true; bool(값이 존재( 0은 제외 )) -> true의미 bool(0, [], {}, "", None 등) -> false의미 True(1)와 False(0) 중 하나만 출력 #include at..