Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

how to change background color in c programming

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

int main()
{
    printf("

		Studytonight - Best place to learn


");

    //BACKGROUND_RED| BACKGROUND_GREEN| BACKGROUND_BLUE| BACKGROUND_INTENSITY
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_BLUE|BACKGROUND_RED|BACKGROUND_INTENSITY);
    printf("

Studytonight just showed you how to put colors to your code!!");

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_GREEN);
    printf("

Isn't this Awesome?");

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY|BACKGROUND_RED);
    printf("

You just did something that only 1 out of 10 coders are familiar of :)
");

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_GREEN|BACKGROUND_INTENSITY);
    printf("

You are doing great!!");

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_BLUE|BACKGROUND_INTENSITY);
    printf("

The best is yet to come!");

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_GREEN|BACKGROUND_INTENSITY);
    printf("

What are you waiting for?? Just play with it!!");

    printf("

			Coding is Fun !


");
    return 0;
}
Source by www.studytonight.com #
 
PREVIOUS NEXT
Tagged: #change #background #color #programming
ADD COMMENT
Topic
Name
6+4 =