October 22nd, 2013, 09:49 AM
Simple C Program help (Interview Test)
Using C or C++, write a small application that takes as input a set of line coordinates, and renders them to ASCII line art.
The program should accept an inputs of the form (x,y) – (x,y), (x,y) – (x,y), … where (x,y) are the coordinates of the line segments. The program should accept an arbitrary number of line segments.
The coordinate range is between 0 and 19 on x and 0 to 9 on y, and the output should be a 20x10 array of ASCII characters.
The program should be able to handle any number of lines from any coordinates.
For example, the input string (4,9) – (14,0), (0,4) – (19,4) must produce the following output on stdout:
Brevity will be rewarded. Use only standard libraries - the use of non-standard (e.g. Boost) or platform specific libraries (e.g. Win.h) is disallowed. Feel free to search the internet to help you solve the task.
You may use either GCC or MSVC to complete the task. The completed submission should have either a valid Makefile or build script for GCC or else an MSVC project as appropriate.
You should assume this project is intended for commercial use and code your solution accordingly.
October 22nd, 2013, 10:21 AM
So then what was your answer?
Be sure to use code tags to preserve the indentation.