Here is what I did with my program, if the line I want to highlight is cin or cout or whatever, just put this code above that line
SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), 0x0F);
the last part ie, 0x0F allows you to change the color code of the background and text
after you change it to the desired color, just insert another one below the line you want to highlight, for example,
SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), 0x0C);
here is a table of colors and their codes
0 = Black 8 = Gray 1 = Blue 9 = Light Blue 2 = Green A = Light Green 3 = Aqua B = Light Aqua 4 = Red C = Light Red 5 = Purple D = Light Purple 6 = Yellow E = Light Yellow 7 = White F = Bright White
EXAMPLE for black background and blue text;
SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), 0x01);
Wysla source share