Computer Graphics Programs

 

Write a Program to draw basic graphics construction like line, circle, arc, ellipse and rectangle.

Program:

  1. #include<graphics.h>  
  2. #include<conio.h>  
  3. void main()  
  4. {  
  5.     intgd=DETECT,gm;  
  6.     initgraph (&gd,&gm,"c:\\tc\\bgi");  
  7.     setbkcolor(GREEN);  
  8.     printf("\t\t\t\n\nLINE");  
  9.     line(50,40,190,40);  
  10.     printf("\t\t\n\n\n\nRECTANGLE");  
  11.     rectangle(125,115,215,165);  
  12.     printf("\t\t\t\n\n\n\n\n\n\nARC");  
  13.     arc(120,200,180,0,30);  
  14.     printf("\t\n\n\n\nCIRCLE");  
  15.     circle(120,270,30);  
  16.     printf("\t\n\n\n\nECLIPSE");  
  17.     ellipse(120,350,0,360,30,20);  
  18.     getch();  
  19. }  

Output

Computer Graphics Programs

Post a Comment

Previous Post Next Post