This is an implementation of the Bresenham line drawing algorithm. The program is based on 3 classes, vertex, line and grid. I wrote it with a view to future expansion, so it makes use of templates and flexible STL structures.

The program loads the line data from the input file. The two example lines are already saved there for demonstation. The lines are drawn on a 20*10 grid. Coordinates start from 0. Out-of-bounds coords will not be accepted by the program.

The full source code, with visual studio 2010 project files, is available HERE.

There are many implementations of the algorithm on the web, but one more example can't hurt. Bear in mind this functon uses variables and classes implimented elsewhere: