Изменение цвета в консоли

#include <iostream>
#include <Windows.h>
using namespace std;

void main() {
	setlocale(LC_ALL,"rus");
	HANDLE h;
	COORD cr;
	h = GetStdHandle(STD_OUTPUT_HANDLE);
	SetConsoleTextAttribute(h, 15);

	for (int i = 0; i<300;) {
		SetConsoleTextAttribute(h, i);
		cout << " X ";

		SetConsoleTextAttribute(h, 15);
		cout << " - SetConsoleTextAttribute(h, " << i << ")\n";

		i += 17;
	}
	SetConsoleTextAttribute(h, 15);
	system("pause");
}