Change Text Background Color - Devbhoomi

FREE JOB ALERT & ONLINE TUTORIALS

Hot

Post Top Ad

Monday 6 November 2017

Change Text Background Color

#include<windows.h>
#include<stdio.h>

int main()
{
    //BACKGROUND_RED | BACKGROUND_GREEN| BACKGROUND_INTENSITY | BACKGROUND_BLUE
    SetConsoleTextAttribute (GetStdHandle(STD_OUTPUT_HANDLE),
                             BACKGROUND_BLUE|BACKGROUND_RED);
    printf("\n\nBackground Color Change");

    SetConsoleTextAttribute (GetStdHandle(STD_OUTPUT_HANDLE), 
                             BACKGROUND_GREEN);
    printf("\n\nBackground Color Change");

    SetConsoleTextAttribute (GetStdHandle(STD_OUTPUT_HANDLE), 
                             BACKGROUND_INTENSITY);
    printf("\n\nBackground Color Change");

    SetConsoleTextAttribute (GetStdHandle(STD_OUTPUT_HANDLE), 
                             BACKGROUND_RED);
    printf("\n\nBackground Color Change");

    SetConsoleTextAttribute (GetStdHandle(STD_OUTPUT_HANDLE), 
                             BACKGROUND_BLUE);
    printf("\n\nBackground Color Change");

    SetConsoleTextAttribute (GetStdHandle(STD_OUTPUT_HANDLE), 
                             BACKGROUND_RED|BACKGROUND_INTENSITY);
    printf("\n\nBackground Color Change");

    return 0;
}
OUTPUT

No comments:

Post a Comment

Post Top Ad