#include <iostream>
using namespace std;
#include "OSspec.h"

#ifdef UNIX //Unix code:

#include <termios.h>

void clrScr() {
	system("clear");
}

char inputCh(bool echo) {	
	struct termios oldt,newt;
	tcgetattr( STDIN_FILENO, &oldt );
	newt = oldt;
	newt.c_lflag &= ~( ICANON | ECHO );
	tcsetattr( STDIN_FILENO, TCSANOW, &newt );
	char inCh = getchar();
	tcsetattr( STDIN_FILENO, TCSANOW, &oldt );
	if ((int)inCh == 10) { //ENTER key
		inCh = (char)0;
	}
	if (echo) {
		cout << inCh;
	}
	return inCh;
}
#else //Windows code:

#include <conio.h>

void clrScr() {
	system("cls");
}

char inputCh(bool echo) {
	const char inCh = getch();
	if (echo) {
		cout << inCh;
	}
	return inCh;
}

#endif

