Draw Rainbow using C Graphics.
#include<stdio.h>
#include<graphics.h>
#include<dos.h>
void main(){
int i , gd = DETECT , gm;
initgraph(&gd , &gm ,"c:\\tc\\bgi");
for(i = 0 ; i < 350 ; i++)
{
if(i % 25 == 0)
setcolor(rand() % 16);
arc(350 , 400 , 0 , 180 , i) ;
delay(10);
}
getch();
closegraph();
}
Output:
#include<stdio.h>
#include<graphics.h>
#include<dos.h>
void main(){
int i , gd = DETECT , gm;
initgraph(&gd , &gm ,"c:\\tc\\bgi");
for(i = 0 ; i < 350 ; i++)
{
if(i % 25 == 0)
setcolor(rand() % 16);
arc(350 , 400 , 0 , 180 , i) ;
delay(10);
}
getch();
closegraph();
}
Output:

Very good.Give more graphics programs.
ReplyDeleteGive the C programming of shining stars.
ReplyDelete