how to draw Indian flag using c programming in computer graphics

 HOW TO DRAW A INDIAN FLAG IN COMPUTER GRAPHICS USING C PROGRAMMING





To draw a INDIAN flag in computer graphics using c programming copy this code and compile in turbo c++.

program video link:- 

program:-

#include<conio.h>
#include<stdio.h>
#include<math.h>
#include<graphics.h>
#define PI 3.14
void main()
{
  int gd=DETECT,gm,i,px[4]={101,160,180,200},py[4]={102,90,120,100};
  int a=150,b=132,r=10;
  double t=0.0,x=0.0,y=0.0;
  initgraph(&gd,&gm,"C:\\TC\\BGI");
      setbkcolor(LIGHTBLUE);

  //base
  line(0,470,600,470);
  rectangle(50,450,150,470);
  rectangle(80,425,120,450);
      setfillstyle(SOLID_FILL,DARKGRAY);
  floodfill(51,451,WHITE);
  floodfill(81,426,WHITE);
  //line
  line(97,425,97,100);
  line(101,425,101,100);
  circle(99,97,5);
      setfillstyle(SOLID_FILL,BROWN);
  floodfill(100,420,WHITE);
      setfillstyle(SOLID_FILL,YELLOW);
  floodfill(100,98,WHITE);
  //FLAG
while(t<=1.0)
  {
  x=pow(1.0-t,3)*px[0]
   +3*t*pow(1.0-t,2)*px[1]
       +3*t*t*(1.0-t)*px[2]
   +pow(t,3)*px[3];
 y=pow(1.0-t,3)*py[0]     +3*t*pow(1.0-t,2)*py[1]
    +3*t*t*(1.0-t)*py[2]
       +pow(t,3)*py[3];

   putpixel(x,y,WHITE);
 putpixel(x,y+20,WHITE);
   putpixel(x,y+40,WHITE);
   putpixel(x,y+60,WHITE);
   t=t+0.001;
  }
line(200,100,200,160);
  setfillstyle(SOLID_FILL,LIGHTRED);
  floodfill(110,110,WHITE);

  setfillstyle(SOLID_FILL,WHITE);
  floodfill(110,130,WHITE);
  setfillstyle(SOLID_FILL,GREEN);
 floodfill(110,150,WHITE);
  //ASHOKA
 for(i=0;i<=360;i=i+15)
  {
   x=r*cos(i*PI/180);    y=r*sin(i*PI/180);
   setcolor(BLUE);
   line(a,b,a+x,b-y);
  }
  circle(a,b,r);

  getch();
}


video link of this program:-

output:-

loading...

video link:- 

keywords:-
    India, Indian, Indian flag, Happy Independence day, 15 august, 2021, 15 aug 2021, sadhinata dibas, c programming, computer graphics, computer graphics using c, computer graphics with c, c program to draw a Indian flag, draw a flag in computer graphics, draw Indian flag in computer graphics, independence day special, India independence day, love India, national flag, How to draw a national flag in computer graphics using c programming, Indian national flag, national flag of India, vande mataram, bande maataram, jay hind, joi hind, joy hind, bande ma taram, computer science..
  



Comments