Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  pc.c
Language: C/C++
Code:
#include<stdio.h>
#include<graphics.h>
point(int xy[][2],int n,int xmin,int xmax,int ymin,int ymax)
{
    int gd=DETECT ,gm;
    initgraph(&gd,&gm,NULL);
    int i,j;
    for(i=0;i<n;i++)
    {for(j=0;j<2;j++)
    {

        if(xy[i][1]>=xmin&&xy[i][1]<=xmax)
        {

            if(xy[i][2]>=ymin && xy[i][2]<=ymax)
            {

                putpixel(xy[i][1],xy[i][2],6);
            }
        }
    }
    }
    closegraph();
    return 0;
}
int main()
{ int n,xmin,xmax,ymin,ymax;
int xy[n][2];
printf("enter no of points");
scanf("%d",&n);
for(i=0;i<n;i++)
{
for(j=0;j<2;j++)
{
scanf("%d",&xy[i][j]);
}}
xmin=0;
xmax=300;
ymin=0;
ymax=300;
rectangle(xmin,ymin,xmax,ymax);
point(xy,n,xmin,xmax,ymin,ymax);
return 0;
}
     
Comments: