U E D R , A S I H C RSS

시간맞추기/남도연

~cpp 
#include <iostream.h>
#include <conio.h>
#include <ctime>

void main(){
	time_t start = time(0);
	while(1){
	if (kbhit()){		
		if (time(0)-start==8){
			cout<<"You win!!!"<<endl;
		}
		else {
			cout<<"your time is off."<<endl;
		}
		break;
	}
}
		getch();
}

ㅡㅡ 생소한 time과 kbhit() 당황했다 ;;
아직도 time(0)의 쓰임과 뜻을 이해 못한다.. 누가 가르쳐 주시기를 ㅠㅠ
└time(0), time(NULL)뭐 둘다 그말이 그말이지만.. 1970년 1월 1일부터 지나간 초를 알려줍니다. 물런 숫자가 무지무지무지무지 크므로 리턴값은 unsigned long 형 과 유사하며, 단순히 1초가 지날때마다 1씩 증가합니다. 그래서 이럴때 써먹습니다. - 조현태
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:30:17
Processing time 0.0129 sec