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.0141 sec