Note: The path given below in the program ("C:\\TurboC3\\BGI") may vary for your system.
#include<graphics.h>
#include<stdlib.h>
#include<stdio.h>
void main()
{
int gd = DETECT,gm,errorcode;
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();
}
Color is filled pixel by pixel and created a really nice effect
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;
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