C Program for Drawing India's National Flag and Color properly:
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main()
{
int i;
float x,y,PI=3.14;
int gd,gm;
detectgraph(&gd,&gm);
initgraph(&gd,&gm,"C:\\TurboC3\\BGI");
rectangle(80,50,560,380);
line(80,160,560,160);
line(80,270,560,270);
setfillstyle(SOLID_FILL,LIGHTRED);
floodfill(81,51,WHITE);
setfillstyle(SOLID_FILL,WHITE);
floodfill(81,161,WHITE);
setfillstyle(SOLID_FILL,GREEN);
floodfill(81,271,WHITE);
setcolor(BLUE);
circle(320,215,50);
for(i=0;i<=360;i+=15)
{
x=50*cos(i*PI/180);
y=50*sin(i*PI/180);
line(320,215,320+x,215-y);
}
getch();
closegraph();
}
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main()
{
int i;
float x,y,PI=3.14;
int gd,gm;
detectgraph(&gd,&gm);
initgraph(&gd,&gm,"C:\\TurboC3\\BGI");
rectangle(80,50,560,380);
line(80,160,560,160);
line(80,270,560,270);
setfillstyle(SOLID_FILL,LIGHTRED);
floodfill(81,51,WHITE);
setfillstyle(SOLID_FILL,WHITE);
floodfill(81,161,WHITE);
setfillstyle(SOLID_FILL,GREEN);
floodfill(81,271,WHITE);
setcolor(BLUE);
circle(320,215,50);
for(i=0;i<=360;i+=15)
{
x=50*cos(i*PI/180);
y=50*sin(i*PI/180);
I |
}
getch();
closegraph();
}
Output |
Eroor
ReplyDeleteCos should have a prototype
Sin should have a prototype