1~50 숫자 맞추기 게임하는데  


딱 시작하면 시간초가 증가하기 시작하면서 게임 끝내면 그 걸린시간 구하려고하는데 (실시간으로 올라가는 시간초가 보여야함)


이러기 위해서는 스레드를 써야될꺼같아서 


#include <thread> 


하고 


void user_Timer(int s_time)

{

if (timer_start)

{

start_time = GetTickCount()-s_time;

timer_start = false;

}

else{

end_time = GetTickCount() - start_time;

move(20, 25);

cout << end_time;

}

}


이렇게 타이머 만든다음에


int temp1 = GetTickCount();

thread t1(&user_Timer, temp1);

while (1)

{

key = _getch();

switch (key)

{

case LEFT:

if (board_x_index - 1 < 0) break;

remove(x, y);

x -= 10;  

board_x_index--;

select_number(x, y);

break;

case RIGHT:

if (board_x_index + 1 > 4) break;

remove(x, y);

x += 10;

board_x_index++;

select_number(x, y);

break;

case UP:

if (board_y_index - 1 < 0) break;

remove(x, y);

y -= 3;

board_y_index--;

select_number(x, y);

break;

case DOWN:

if (board_y_index + 1 > 4) break;

remove(x, y);

y += 3;

board_y_index++;

select_number(x, y);

break;

case space:

change_number(board[board_x_index][board_y_index], x, y);

break;

}


}

t1.join();


이렇게 호출했는데 이게


while문 전에 join을 하거나 while문 후에 join을 하거나 상관있나??


그리고 아무 숫자도 안뜨는데 스레드가 아예 실행이안되는거같은데 


사용법 아는사람있어??