how to change background color in c programming

Solutions on MaxInterview for how to change background color in c programming by the best coders in the world

showing results for - "how to change background color in c programming"
Angela
13 Jan 2019
1#include<windows.h>
2#include<stdio.h>
3
4int main()
5{
6    printf("\n\n\t\tStudytonight - Best place to learn\n\n\n");
7
8    //BACKGROUND_RED| BACKGROUND_GREEN| BACKGROUND_BLUE| BACKGROUND_INTENSITY
9    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_BLUE|BACKGROUND_RED|BACKGROUND_INTENSITY);
10    printf("\n\nStudytonight just showed you how to put colors to your code!!");
11
12    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_GREEN);
13    printf("\n\nIsn't this Awesome?");
14
15    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY|BACKGROUND_RED);
16    printf("\n\nYou just did something that only 1 out of 10 coders are familiar of :)\n");
17
18    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_GREEN|BACKGROUND_INTENSITY);
19    printf("\n\nYou are doing great!!");
20
21    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_BLUE|BACKGROUND_INTENSITY);
22    printf("\n\nThe best is yet to come!");
23
24    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_GREEN|BACKGROUND_INTENSITY);
25    printf("\n\nWhat are you waiting for?? Just play with it!!");
26
27    printf("\n\n\t\t\tCoding is Fun !\n\n\n");
28    return 0;
29}
similar questions