Professional Documents
Culture Documents
Prog 16
Prog 16
PROGRAM NO. 16 Devise a routine to produce the animation effect of a square transforming to a triangle and then to a circle.
#include<stdio.h> #include<conio.h> #include<graphics.h> #include<conio.h> void main() { int c; int arr[8]={200,200,150,300,250,300,200,200}; int gdriver=DETECT,gmode; initgraph(&gdriver,&gmode,"C:\\tc\\bgi"); clrscr(); setcolor(2); fillpoly(4,arr); setfillstyle(SOLID_FILL,5); getch(); delay(300); for(c=0;c<=50;c++) { arr[0]--; arr[6]++; fillpoly(4,arr); } getch(); clearviewport(); for(c=1;c<=50;c++) { setcolor(2); circle(150,150,c); delay(100); } }
SBIT/CSE/V/MT/IT-208-F
OUTPUT
SBIT/CSE/V/MT/IT-208-F
SBIT/CSE/V/MT/IT-208-F
PROGRAM NO. 16 Devise a routine to produce the animation effect of a square transforming to a triangle and then to a circle.
#include<stdio.h> #include<conio.h> #include<graphics.h> #include<conio.h> void main() { int c; int arr[8]={200,200,150,300,250,300,200,200}; int gdriver=DETECT,gmode; initgraph(&gdriver,&gmode,"C:\\tc\\bgi"); clrscr(); setcolor(2); fillpoly(4,arr); setfillstyle(SOLID_FILL,5); getch(); delay(300); for(c=0;c<=50;c++) { arr[0]--; arr[6]++; fillpoly(4,arr); } getch(); clearviewport(); for(c=1;c<=50;c++) { setcolor(2); circle(150,150,c); delay(100); } }
SBIT/CSE/V/MT/IT-208-F
OUTPUT
SBIT/CSE/V/MT/IT-208-F
SBIT/CSE/V/MT/IT-208-F