As the cycle of the season repeats every year so does the cycle of freshmen in CS that have
to actually learn how to make the computer do something to pass their assigments.
This year I met some CS bachelors at my uni and got interested in their introduction to
programming course and assignments.
Being a young UNIX user I could only scoff at the decision of an acquaintance to actually use C++
for his assignments.
C++ serves experts very well (but isn’t kind to novices)
Many hours were spent on the assignment to convert numbers from one base to another
and more lines of codes where added to make sure to convert from decimal to hexadecimal
and back, from binary to decimal and back and so on…
But no one mentioned him the important principles of UNIX, how everything fit together,
what tools he can use and how eventually data and code are represented so everything was
hopeless and the assignment could not be completed in a simple way.
Instead a wonderful botch was written and eventually it compiled and worked but nothing
new was learnt.
As I like to learn new thing and this is something of a challenge (bonus assignment so kind of
more difficult) I spent some time on it and eventually this is my solution. It works on strings
as they are the only kind of input that is stable across tools, it has some error checking
on the inputs and can be extended to support bases larger than 16.