U E D R , A S I H C RSS

시간맞추기/허아영

각보다는 것 같데 ,
-_- 모르는 보는데 루나 렸다.
그냥 려다 보 ..;
명뿐 다.
kbhit() 데, 면 1, 면 0 다는 것만 다.

그리고, 로그램 . 나 못 맞겠다. 8떻게 !! 낸담 ㅋㅋㅋ
드디다 ! ㅋㅋ

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

void main()
{
	time_t record = 8;
	time_t start_t;
	start_t = time(0);
	printf("wait 8 seconds...\n");
	printf("and press any key exactly...");
	for( ; ; )
	{
		if (kbhit()){
			if(start_t - record == 0)
			{
				printf("You win !!\n");
			}else{
				printf("your time is off.");
			}
			break;
		}
			
	}	
	getch();
}
린 것 같다. 8를 맞다 ㅠ .
↓↓ 고
~cpp 
#include <stdio.h>
#include <conio.h>
#include <time.h>

void main()
{
	time_t record = 8;
	time_t start_t;
	start_t = time(0);
	printf("wait 8 seconds...\n");
	printf("and press any key exactly...");
	for( ; ; )
	{
		if (kbhit()){
			if(time(0) - start_t == record)
			{
				printf("You win !!\n");
			}else{
				printf("your time is off.");
			}
			break;
		}

	}
	getch();
}

드디다! ㅎ

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

void main() 
{ 
	time_t record = 8; 
	time_t start_t; 
	start_t = time(0); 
	printf("wait 8 seconds...\n"); 
	printf("and press any key exactly..."); 
	for( ; ; ) 
	{ 
		if (kbhit()){ 
			if(time(0)-start_t  == record-1 ) // 
			{ 
				printf("You win !!\n"); 
			}else{ 
				printf("your time is off."); 
			} 
			break; 
		} 
	}        
	getch(); 
} 
린 답변보다 답변..^^
가깝게 바꿨.^^
time(0) 는 부고(time(0)-start_t 부),
record로면 9가되( 0부^^) -1.

그나 ..^^ 내라구~ !!
나는 만 가게 러.. -

- .. 9가 되 리는구나.. ㅎㅎ ~ 내가 보다 겠냐 ㅋㅋㅋ
0~1,->1, 렇게 ,, record가 게 8 되더라 ㅎㅎ
- ㅎㅎㅎㅎ 그렇게 ..ㅎㅎㅎ
..그렇게 그게 맞는것..ㅎㅎㅎ
그런데 time() 방법는 문는데 말..ㅎㅎ
0 -> 1 되는 0로 가까, 1로 가까 다는 ..ㅎㅎㅎ
time() 기능..ㅎㅎ 말고 다른방법 는게 더 데..ㅎㅎㅎ
다른 만.. 뭐~~
..모르겠다.ㅎㅎㅎ 가 다 ..ㅎㅎ 난 래~^^ .ㅎㅎ 그럼 고 -
내가 보기는 clock() 로그램 는 것라고 들는데, 떻게 까? -
.. clock_t라는 time_t랑 를 만들고 변명=clock() 라고로그램 된 뒤부 기록되는군.. 그런데 는다는 단..;;ㅁ;; -
라. 다 그 ㅋㅋ . 문 께 ~ . -



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