#include <windows.h>
#include <stdio.h>
void SetColorAndBackground(int ForgC, int BackC);
void main()
{
int f,b;
system("cls");
printf("Enter fore and background color code : ");
scanf("%d",&f);
SetColorAndBackground(f,16); //color value range 0 up-to 256
printf("what is text background color");
SetColorAndBackground(30,256);
printf("\nCOLOR IN CODE BLOCKS...");
getch();
}
void SetColorAndBackground(int ForgC, int BackC)
{
WORD wColor = ((BackC & 0x0F) << 4) + (ForgC & 0x0F);;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), wColor);
}
Related Posts:
Sorting names in C#include<stdio.h>
//#include<string.h>
void copystring(char txt1[], char txt2[])
{
int k;
for(k=0;txt2[k]!='\0';k++)
{
txt1[k]=txt2[k];
… Read More
Find largest and smallest no. in C#include<stdio.h>
void main()
{
int x[10],i,j,temp;
for(i=0;i<=9;i++)
{
printf("Enter %dth number : ",i+1);
scanf("%d"… Read More
Count no. of words in a sentence in C#include<stdio.h>
void main()
{
char str[50],i,wordcount=0;
printf("Enter a line of text : ");
gets(str);
for(i=0;str[i]!='\0';i++)
{
&… Read More
Display string after deleting vowels in it in C#include<stdio.h>
void main()
{
char str[50],i;
printf("Enter a string : ");
gets(str);
printf("\nAfter deleting vowels :\t");
for(i=0;str[i]!='\0'… Read More
Arranging numbers in ascending and descending order in C#include<stdio.h>
void main()
{
int x[5],i,j,temp;
for(i=0;i<=4;i++)
{
printf("Enter x[%d]th number : ",i);
scanf("%d"… Read More
0 comments:
Post a Comment