Microsoft HPC

Programming Teasers in C++ and Matlab

I came across a set of programming exercises from the 2007 World Intercollegiate Programming Contest. You could program these in Matlab or C++, for example but the usefulness of these questions is that they test a number of skills:

. Analysing a problem (what is the problem)

. Designing (how to solve the problem)

. Matlab/C++ (implement the problem)

So, the process is "what to do, how to do, do" in that order. This approach is also good for the thought process; each activity is independent and feeds into it successor.

At the design level, the crucial element is the design of appropriate data structures and the corresponding algorithms that operate on them.

The choice between OO and generic programming is a non-issue because they both can be used.

I would recommend using STL and boost because they have the tools that we use as the plumbing. Matlab also has many libraries as well.

Testing student knowledge using these kinds of tests is more telling than focusing exclusively on syntax.

The thread on Software and the link to the original ACM questions is:

//

http://www.wilmott.com/messageview.cfm?catid=10&threadid=60837

//

In the C++ Lion's Den: Learning C++ step-by-step

Learning C++, Part I Get it working

A well-kept secret concerning the taming of the C++ lion is that you must learn the fundamentals before you start using more advanced syntax. Here is my own personal list that I have used with (very many) students since 1991. It corresponds to green belt knowledge:

1.Basic class structure; private and public members; header and code files

2.The vital keyword ‘const’ and the 4 places where it is used

3.Function and operator overloading; creating your own operators

4.Memory management; STACK and HEAP

5.Basic templates; STL, list container and simple iterators

I have found that once these issues are mastered (ESPECIALLY point 4) then you will have few major problems later.

C++ is a large and flexible language. By neglecting the fundamentals we run the risk of floundering when embarking on real projects. As in judo, learn how to break fall before attempting a hip throw!