Revision: 68821
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 3, 2015 02:12 by ZeusEm
Initial Code
//Shubham Mehta, Write a program to implement Digital Differential Analyzer Algorithm. #include<stdio.h> #include<conio.h> #include<graphics.h> void main() { int gd, gm; float x, y, x1, x2, y1, y2, slope; clrscr(); printf("%s", "Please enter x1: "); scanf("%f", &x1); printf("%s", "Please enter y1: "); scanf("%f", &y1); printf("%s", "Please enter x2: "); scanf("%f", &x2); printf("%s", "Please enter y2: "); scanf("%f", &y2); slope=(y2-y1)/(x2-x1); gd=DETECT, gm; initgraph(&gd, &gm, "C:\\TC\\BGI"); if(slope<1) { for(; x1<=x2; x1++) { y1+=slope; putpixel(x1, y1, RED); } } else { for(; y1<=y2; y1++) { x1+=slope; putpixel(x1, y1, RED); } } getch(); closegraph(); }
Initial URL
Initial Description
This is an implementation of the DDA (Digital Differential Analyzer) Algorithm in Computer Graphics Design in the C programming language.
Initial Title
Graphic Design | Digital Differential Analyzer (DDA) Algorithm
Initial Tags
Initial Language
C