U E D R , A S I H C RSS

시간맞추기/조현태

소 �

..문제는 별로 어렵지 않았다. time�녀��야 �소�� 쓰니까..
그런�.. ��체 왜 for를 쓰�고 했는지..ㅠ.ㅜ while� 아니고..
뭔가 for를 for답게 뽀대나게 만들어 줄려고 하다보니 길어졌다.^^;;;
그리고 문제� 오차율� 빠져있었다. 얼마나 정확하게 하�는건지..1/1000초는 아�테지?? 1/100�가??
본�� 귀차니즘으로 그냥 1초.ㅎㅎ 8-9초사�� 눌러주기만 하면 �다.^^

소스

~cpp 
#include <iostream>
#include <time.h>
#include <conio.h>
using namespace std;

const int ANSWER_TIME=8;

void main()
{
	int second;
	time_t before_time;
	before_time=time(&before_time);
	for (second=0; !kbhit(); ++second)
	{
		time_t now_time;
		time(&now_time);
		while(now_time==before_time)
		{
			time(&now_time);
		}
		time(&before_time);
	}
	if (second==ANSWER_TIME-1)
		cout << "you win!!!";
	else
		cout << "your time is off." << second;
	system("PAUSE");
}

나한테 할 �

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