This is just a simple, bite-sized project to give prospective employers an easily digestible sample of my C++ code; nothing revolutionary here. This is a small project that I was asked to do a couple of years ago in order to secure a job interview, struck me that what was useful as a code sample for one employer could be useful to another - so, decided to put it up here just for the sake of having something publicly available that's small enough for people to browse through in 10 minutes or so.
Below is the brief that I was sent:
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
Please spend around 3 hours on the following task:
Using any programming language or environment, write a small application that takes as input a set of line coordinates, and renders them to ASCII line art.
The program should accept a string as input line data, of the form “(x,y) – (x,y), (x,y) – (x,y), …” where (x,y) are the coordinates the 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.
For example, the input string “(10,10) – (10,0), (0,4) – (19,4)” might produce the following output:
X
X
X
X
X X X X X X X X X X X X X X X X X X X X
X
X
X
X
X
However, you may wish to consider using other ASCII characters such as ‘/’, ‘_’ and ‘|’ to produce a nicer output.
Reward will be given for concise code and inventive ideas! Feel free to search the internet to help you solve the task.