Wednesday, 1 July 2015

Indian Flag Colors effect


Note:  The path given below in the program ("C:\\TurboC3\\BGI") may vary for your system.


Computer Graphics, C program to draw Indian Flag
Color is filled pixel by pixel and created a really nice effect

Computer Graphics, C program to draw Indian Flag
Final output (I haven't created spokes in flag)

#include<graphics.h>

#include<stdlib.h>
#include<stdio.h>



void main()

{
 int gd = DETECT,gm,errorcode;
 errorcode = graphresult();
 
  if( errorcode != grOk )
  {
    printf("Graphics error : %s\n",grapherrormsg(errorcode));
 
    printf("Press any key to exit...\n");
    getch();
    exit(EXIT_FAILURE);
  }

 initgraph(&gd,&gm,"C:\\TurboC3\\BGI");

 while(!kbhit())
{
putpixel(random(640),random(160),LIGHTRED);
putpixel(random(640),random(160)+160,WHITE);
putpixel(random(640),random(160)+320,GREEN);


}
closegraph();
}

No comments:

Post a Comment