U E D R , A S I H C RSS

시간맞추기/김태훈zyint

소 감

kbhit이라든지 time 함수들은 써본적이 없어서-_- 네이버 검색해서 알아냈다.
8초 맞추기 ...... 커서 껌벅이는게 1초간격이라 맞추기 쉽다 +ㅁ+

소스

~cpp 
#include <stdio.h> 
#include <conio.h>
#include <time.h>


int main()
{

	int last;

	
	//게임 시작했을 때 시간 가져오기
	last = time(0);

	for(;;) {
		//눌렀다!
		if(kbhit())
		{
			// 지난 시간 == (time(0) - last)
			if((time(0) - last)==8)
				printf("you win!!! \n");
			else
				printf("your time is off. \n");

			break;
		}
	}

	getch();
	return 0;
}

나한테 할 말

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:30:17
Processing time 0.0134 sec