실행화면에서 *가 주기적으로 아래로 이동하는 프로그램을 만들어야하는데요..
어떻게 건드려야할지 모르겠네요
#include <stdio.h>
#include <stdlib.h> // rand, srand 함수
#include <time.h> // time, clock 함수
#include <conio.h> // getch, kbhit 함수
#include "util.h"
// 함수 프로토타입을 먼저 기술하고 함수 정의는 main 함수 아래에 작성한다.
int main(void)
{
char object = '*'; // 출력할 문자
Point position; // 출력할 위치, falling_speed가 지나면 update됨
double falling_speed = 0.5; // 떨어지는 속도, 작을수록 빨라짐
int key; // 사용자 입력키
int stop = 0; // 멈춤 여부
clock_t start_time = clock(); // 현재 시각 저장
srand(time(NULL));
SetCursorVisible(FALSE);
// falling_speed가 지나면 한 칸씩 아래로 이동하도록 한다.
// 만약 맨 아래(y=25)까지 도달했다면 다시 맨 위의 임의의 위치부터 다시 시작한다.
while (1)
{
if (kbhit()) // 키보드 p키가 눌러졌다면 일시정지 처리
{
}
}
return 0;
}
댓글 0