Search
 
SCRIPT & CODE EXAMPLE
 

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;
}
Comment

PREVIOUS NEXT
Code Example
C :: rust cross compile 
C :: getchar in c 
C :: set the nth bit 
C :: Installing Tailwind 
C :: c median of array 
C :: c print 2d array 
C :: hourglass sum 
C :: char ASCII in c 
C :: C program to input the month number and output the month name using switch statement 
C :: chevront de vlavier 
C :: ex: C hello world 
C :: Happy birthday in C 
C :: how to check the word is present in given char array in c 
C :: redis service 
C :: c conventions 
C :: check for duplicates c 
C :: size of float in c 
C :: north austin weather 
C :: c for result 
C :: float da 4 byte 
C :: dev c online 
C :: permutation and combination program in c 
C :: %s and string pointer 
C :: minimun number of moves in c 
C :: C Change Value of Array elements 
C :: 11*179*.9*1.35 
C :: fina students name by using html backend database 
C :: Odd-Even-inator with function in C 
C :: captive portal esp8266 
C :: c printf affichage 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =