Witam.
Mam problem z kolorowaniem tekstu w konsoli.
Wszystko pięknie działa, ale po pewnym czasie wypełnienie tła zajmuje całą szerokość konsoli a nie tylko linie z tekstem.
Poniżej kod programu:
#include "stdafx.h"
#include <iostream>
#include "conio.h"
#include <math.h>
#include <windows.h> // WinApi header
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
HANDLE hConsole;
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
int n = 1;
while(!kbhit())
{
SetConsoleTextAttribute(hConsole,50);
cout << pow(-1.0,n-1)/(2*n-1) << endl;
n++;
}
return 0;
}