Display File Creation CG

Ram Pothuraju
This program is accept actual co-ordinates & prepare its Display file.  



#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();
}

Post a Comment

0Comments

Post a Comment (0)