Plz solve these problems using "c" (graphics)
Solved/Closed
ashes_2010
Posts
1
Registration date
Friday April 30, 2010
Status
Member
Last seen
April 30, 2010
-
Apr 30, 2010 at 06:37 AM
mahendra - Feb 12, 2015 at 08:02 AM
mahendra - Feb 12, 2015 at 08:02 AM
Related:
- In c graphics, detect is a
- Nvidia graphics driver auto detect - Guide
- Accelerated graphics port - Guide
- How to detect new hard drive windows 11 - Guide
- Should i disable integrated graphics - Guide
- Aorus graphics engine download - Download - Cleaning and optimization
5 responses
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main()
{
int gdriver=DETECT,gmode=0;
int i;
initgraph(&gdriver, &gmode,"c:\\tc\\bgi");
cleardevice();
rectangle(0,0,639,479);
outtextxy(280,20,"HUMAN FACE");
arc(320,190,180,120);
line(200.190,440,190);
arc(320,230,160,380,120);
arc(440,230,270,450,20);
arc(200,230,90,270,20);
circle(260,220,10);
circle(380,220,10);
for(i=0;i<2;i++)
{
arc(260,213+I,30,150,13);
arc(380,213+I,30,150,13);
}
line(320,240,302,280);
arc(320,270,210,330,20);
arc(320,290,210,330,30);
line(215,290,100,350);
line(100,350,90,440);
line(425,290,540,350);
line(540,350,550,440);
line(320,350,320,440);
getch();
}
#include<conio.h>
#include<graphics.h>
void main()
{
int gdriver=DETECT,gmode=0;
int i;
initgraph(&gdriver, &gmode,"c:\\tc\\bgi");
cleardevice();
rectangle(0,0,639,479);
outtextxy(280,20,"HUMAN FACE");
arc(320,190,180,120);
line(200.190,440,190);
arc(320,230,160,380,120);
arc(440,230,270,450,20);
arc(200,230,90,270,20);
circle(260,220,10);
circle(380,220,10);
for(i=0;i<2;i++)
{
arc(260,213+I,30,150,13);
arc(380,213+I,30,150,13);
}
line(320,240,302,280);
arc(320,270,210,330,20);
arc(320,290,210,330,30);
line(215,290,100,350);
line(100,350,90,440);
line(425,290,540,350);
line(540,350,550,440);
line(320,350,320,440);
getch();
}
FLAG HOSTING
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<math.h>
#include<dos.h>
void main()
{
int gd=DETECT,gm,i,j,x,y,x1,y1;
initgraph(&gd,&gm,"");
x=getmaxx()/2;
y=getmaxy();
line(x,y,x,50);
line(x-6,y,x-6,50);
line(x-50,y-1,x-40,y-1);
line(x-6,50,x+50,50);
while(y>132)
{
setfillstyle(0,0);
bar(x+1,y-60,x+50,y-80);
bar(x+1,y-40,x+50,y-60);
bar(x+1,y-20,x+50,y-40);
y--;
setfillstyle(1,4);
bar(x+1,y-60,x+50,y-80);
setfillstyle(9,15);
bar(x+1,y-40,x+50,y-60);
setfillstyle(1,2);
bar(x+1,y-20,x+50,y-40);
delay(20);
}
getch();
}
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<math.h>
#include<dos.h>
void main()
{
int gd=DETECT,gm,i,j,x,y,x1,y1;
initgraph(&gd,&gm,"");
x=getmaxx()/2;
y=getmaxy();
line(x,y,x,50);
line(x-6,y,x-6,50);
line(x-50,y-1,x-40,y-1);
line(x-6,50,x+50,50);
while(y>132)
{
setfillstyle(0,0);
bar(x+1,y-60,x+50,y-80);
bar(x+1,y-40,x+50,y-60);
bar(x+1,y-20,x+50,y-40);
y--;
setfillstyle(1,4);
bar(x+1,y-60,x+50,y-80);
setfillstyle(9,15);
bar(x+1,y-40,x+50,y-60);
setfillstyle(1,2);
bar(x+1,y-20,x+50,y-40);
delay(20);
}
getch();
}
simple code to Draw Indian flag.
--------------------------------------------
#include<stdio.h>
#include<graphics.h>
#include<dos.h>
#include<conio.h>
void flag1();
void main()
{
int driver=DETECT,mode;
initgraph(&driver,&mode," ");
flag1();
getch();
closegraph();
}
void flag1()
{
int i;
setfillstyle(SOLID_FILL,6);
bar(50,50,300,100);
setfillstyle(SOLID_FILL,WHITE);
bar(50,100,300,150);
setfillstyle(SOLID_FILL,GREEN);
bar(50,150,300,200);
setfillstyle(SOLID_FILL,8);
bar(40,20,50,460); /* flagpole */
setcolor(9);
setfillstyle(SOLID_FILL,WHITE);
for(i=0;i<360;i=i+15)
pieslice(175,125,i,i+15,25);
}
--------------------------------------------
#include<stdio.h>
#include<graphics.h>
#include<dos.h>
#include<conio.h>
void flag1();
void main()
{
int driver=DETECT,mode;
initgraph(&driver,&mode," ");
flag1();
getch();
closegraph();
}
void flag1()
{
int i;
setfillstyle(SOLID_FILL,6);
bar(50,50,300,100);
setfillstyle(SOLID_FILL,WHITE);
bar(50,100,300,150);
setfillstyle(SOLID_FILL,GREEN);
bar(50,150,300,200);
setfillstyle(SOLID_FILL,8);
bar(40,20,50,460); /* flagpole */
setcolor(9);
setfillstyle(SOLID_FILL,WHITE);
for(i=0;i<360;i=i+15)
pieslice(175,125,i,i+15,25);
}
Concentric Circles
---------------------------------
#include<graphics.h>
main()
{
int gd=DETECT,gm;
int n,x=10;
initgraph(&gd,&gm," ");
printf("How many concentric circles do you want?");
scanf("%d",&n);
while(n!=0)
{
circle(240,150,x);
setcolor(GREEN);
x+=10;
n--;
}
getch();
closegraph();
}
---------------------------------
#include<graphics.h>
main()
{
int gd=DETECT,gm;
int n,x=10;
initgraph(&gd,&gm," ");
printf("How many concentric circles do you want?");
scanf("%d",&n);
while(n!=0)
{
circle(240,150,x);
setcolor(GREEN);
x+=10;
n--;
}
getch();
closegraph();
}
Mar 9, 2011 at 08:58 AM