#include<stdio.h>
#include<windows.h>
#include<time.h>
using namespace std;
#define keydown(vk) ((GetAsyncKeyState(vk) & 0x8000)?1:0)
#define LMB MOUSE_MOVED
#define MMB MOUSE_WHEELED
#define RMB MOUSE_EVENT
int main(){
	long begin_time = clock();
	while (true){
		
		printf ("Time: %.3lf\n", 1.0 * (clock() - begin_time) / CLOCKS_PER_SEC);
		
		printf ("Keyboard:\n");
		if (keydown(32))
			printf ("Space ");
		for (int i = 33;i < 128;++i)
			if (keydown(i))
				printf ("%c ", i);
		printf ("\n\n");
		
		printf ("Mouse:\n");
		if (keydown(LMB)) printf ("Left ");
		if (keydown(MMB)) printf ("Mid ");
		if (keydown(RMB)) printf ("Right");
		
		Sleep(10);
		system("cls");
	}
	return 0;
}