I have a program that I am trying to get to color the correct answers. For my testing stages I am just trying to get it to color the T green, and the F red.
Code:
//Easy Coloring Of Words/Letters
#define Color_White SetConsoleTextAttribute(stdOut, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);
#define Color_Red SetConsoleTextAttribute(stdOut, FOREGROUND_RED | FOREGROUND_INTENSITY);
#define Color_Green SetConsoleTextAttribute(stdOut, FOREGROUND_GREEN | FOREGROUND_INTENSITY);
#define Color_Blue SetConsoleTextAttribute(stdOut, FOREGROUND_BLUE | FOREGROUND_INTENSITY);
Code:
//Here is the for statements
for(x=0; x<size; ++x)
{
Color_White
cout<<endl<<setw(7)<<student[x];
cout.flush();
for(y=0; y<10; ++y)
{
if(score[y][x] == 'T') //If It is 'T' then it is green
{
Color_Green
cout<<score[y][x+1];
cout.flush();
}
else if(score[y][x] == 'F') //If it is 'F' then it is red
{
Color_Red
cout<<score[y][x+1];
cout.flush();
}
else //If for some odd reason it isnt one fo the two, its blue
{
Color_Blue
cout<<score[y][x+1];
cout.flush();
}
}
cout.flush();
Color_White
cout<<" # Correct: "<<setw(5)<<count[x]<<"Grade: "<<grade[x];
}
The for statements or something dont work. It colors them randomly. I will include the source code so you can get the big picture.