answersLogoWhite

0


Best Answer

#include<stdio.h> #include<conio.h> #include<math.h> #include<graphics.h> void draw_line(float,float,float,float); main() { int driver,mode; float x1,y1,x2,y2; clrscr(); printf("Enter the two endpoints of the line:"); printf("\nx1 ="); scanf("%f",&x1); printf("y1 ="); scanf("%f",&y1); printf("x2 ="); scanf("%f",&x2); printf("y2 ="); scanf("%f",&y2); clrscr(); driver = DETECT; initgraph(&driver,&mode,"\\tc\\bgi"); \\path of bgi can be different in your case draw_line(x1,y1,x2,y2); getch(); closegraph(); } void draw_line(float x1,float y1,float x2,float y2) { float dy,dx; float x,y; float p,p0,dp1,dp2; dy = y2-y1; dx = x2-x1; p0 = 2 * (dy - dx); dp1 = 2 * dy; dp2 = 2 * (dy - dx); putpixel(x1,y1,EGA_WHITE); p = p0; for(x=x1+1,y=y1;x<x2;x++) { if(p < 0) { p = p+dp1; putpixel(x,y,EGA_WHITE); } else { p = p+dp2; y++; putpixel(x,y,EGA_WHITE); } }

User Avatar

Wiki User

11y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

dda algorithm,
bresenham's algorithm,
midpoint algorithm..

These are the few that are useful in my opinion.

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

automobile programming language implementation by algorithm

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Implement Bresenham algorithm using c language?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Can you provide a solution to the diamond-square algorithm using Java and recursion?

Yes. It is possible to provide a solution to the diamond-square algorithm using Java and recursion.


How do you sinx without using mathh or built in sin function Any Algorithm to implement sin function?

You can compute sin(x) manually/numerically using Taylor's Series.


How do you implement algorithm in layered approach using conditional random field intrusion detection?

if u having this project means mail to aravindramesh11@gmail.com


What is the algorithm for determining the maximum of two numbers?

Compare two numbers, a and b. If a is greater than b then return a, otherwise return b. In C, we can implement this algorithm using the ternary operator (?:), as follows: return a&gt;b?a:b;


What the difference between algorithm and pseudocode?

An algorithm is a description of a method for accomplishing some task. For example, an algorithm for driving to a friend's house could be:1. Find your keys2. Get into the car3. Start the engine4. Put transmission into gearetc...Psuedocode is an implementation of an algorithm in a code-like format. For example, the above algorithm in psuedocode could look something like:while(keys.location != "in your hand"){search_for_keys();}walk_to_car();if(car.door == locked)car.door.unlock();engine.start();...An algorithm describes the steps required to solve a problem. Algorithms are written using natural language (e.g., English).Pseudocode is a human-readable version of an algorithm written using an informal language that is very similar to a programming language but which can be more easily translated into any specific programming language.


How do you run graphics program in C?

pro c language to implement linear search using pointers


What is the difference between implementation and algorithm?

An algorithm is a instruction for solving a problem. It is typically illustrated using prose, pseudo code or flowcharts, but other methods exist. The algorithm is the "here's how it's going to work" part of the solution. An implementation (of an algorithm) is a specific expression of this algorithm, using a specific programming language or any other suitable means. The implementation is the "here's how I've done it" part of the solution.


How do you implement svm algorithm in java?

A kernel is used to implement the SVM algorithm in practise. An input data space is transformed into the appropriate form using a kernel. The kernel trick is a technique used by SVM. The kernel transforms a low-dimensional input space into a higher-dimensional space in this case. To learn more about data science please visit- Learnbay.co


How do you RSA algorithm c?

Perform encryption on the following PT using RSA and find the CT p = 3; q = 11; M = 5


What are disadvantage of algorithm?

Advantages of an Algorithm: Effective Communication: Since the algorithm is written in English like language, it is simple to understand the step-by-step solutions of the problems. Easy Debugging: Well-designed algorithm makes debugging easy so that we can identify a logical error in the program. Easy and Efficient Coding: An algorithm acts as a blueprint of a program and helps during program development. Independent of Programming Language: An algorithm is independent of programming languages and can be easily coded using any high-level language. Disadvantages of an Algorithm: Developing algorithms for complex problems would be time-consuming and difficult to understand. Understanding complex logic through algorithms can be very difficult.


How do you solve Euclidean algorithm?

GCF(437,1247) using Euclidean algorithm


How do you write a Java program to implement weighted queue using circular doubly linked list?

Add weights to the elements of the queue and use an algorithm to sort the queue every time an element is added.