#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:
Check if a no. is prime or not in C ?#include<stdio.h>
int testprime(int ,int);
void main()
{
int n,prime;
printf("Enter a positive number : ");
scanf("%d",&n);
prime=testprime(n,n/2);
&nbs… Read More
Find HCF in C#include<stdio.h>
int hcf(int a,int b,int c)
{
if(a%c==0 && b%c==0)
return c;
hcf(a,b,c-1);
}
void main()
{
int h,x,y;
printf("Enter two numb… Read More
Application of struct in C#include<stdio.h>
#include<string.h>
struct student
{
char name[20];
int roll;
};
void main()
{
struct student s[10],t;
int i,n,j;
printf("Enter no. of students : "… Read More
Check if a string is palindrome or not in C ?#include<stdio.h>
#include<string.h>
void main()
{
char word[50];
int i,j,l,c=0;
printf("Enter a word : ");
gets(word);
l=strlen(word);
… Read More
Check if 3rd digit of a no. is prime or not in C ?#include<stdio.h>
int digitcount(int x)
{
int r,c=0,i=0,y=x;
while(x!=0)
{
r=x%10;
x=x/10;
c+… Read More
0 comments:
Post a Comment