Display File Creation CG


This program is accept actual co-ordinates & prepare its Display file. This is a part of Mumbai University MCA Colleges CG Programs MCA Computer Graphics

#include<stdio.h>
#include<conio.h>
#include<graphics.h>

void main()
{
int gd=DETECT,gm;
int coord[20][2];
float ncoord[20][2];
int op[20];
int x,y,N,i;
initgraph(&gd,&gm,"C:\\TC\\BGI");
cleardevice();
printf("enter the number of instructions in your prg ");
scanf("%d",&N);
for(i=0;i<N;i++)
{
printf("\nEnter the opcodes & respective co-ordinates in actual form: \n");
scanf("%d%d%d",&op[i],&coord[i][0],&coord[i][1]);
}
printf("\nOPCODE\t(x,\t\ty)");
printf("\n----------------------------------------------------------");
for(i=0;i<N;i++)
{
ncoord[i][0]=(coord[i][0]-0.00)/639.00;
ncoord[i][1]=(coord[i][1]-0.00)/479.00;
printf("\n%d\t(%f      %f)",op[i],ncoord[i][0],ncoord[i][1]);
}

getch();
closegraph();
}

Hope this Program is useful to you in some sense or other. Keep on following this blog for more Mumbai University MCA College Programs. Happy Programming and Studying.

No comments:

Post a Comment