Friday, November 9, 2018

How to change text color in C

This practical will show how to change text color in C Program.

It will Blink Colorful New Year Message on screen without <graphics.h>.

#include<stdio.h>
#include<windows.h>
int main()
{
  int i;
  char *str[] = {"color A1", "color B1","color C1", "color D1"};

  for(i=0; i<4; i++)
  {  
    system(str[i]);
    printf(".....Wishing You and Your Family.....\n\n");
    printf(".....Happy and Prosperous New Year.....");
    Sleep(500);
    system("cls");
    Sleep(500);
  }
  return 0;
}

Output of Program: Following colorful message will blink on screen.

No comments:

Post a Comment