Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  graph
Language: C/C++
Code:
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main()
{
int x,y,x1,y1,x2,y2,p,dx,dy;
int gdriver=DETECT,gmode;
initgraph(&gdriver,&gmode,"C:\tc\BGI:");
printf("nEnter the x-coordinate of the first point ::");
scanf("%d",&x1);
printf("nEnter the y-coordinate of the first point ::");
scanf("%d",&y1);
printf("nEnter the x-coordinate of the second point ::");
scanf("%d",&x2);
printf("nEnter the y-coordinate of the second point ::");
scanf("%d",&y2);
x=x1;
y=y1;
dx=x2-x1;
dy=y2-y1;
putpixel(x,y,2);
p=(2dy-dx);
while(x<=x2)
{
if(p<0)
{
x=x+1;
          
          
Comments: