views:

151

answers:

5

I thought one of the best ways to familiarise myself with C/C++, is to make a helpful library. I was maybe thinking like a geometry library, like to calculate areas, surface area, etc. It would be useful in game programming. Or maybe an algebra library, like for different formulas like the distance formula, quadratic formula, etc. Or maybe like a standard library for very simple functions, like calculating the number of items in an array.

A: 

Much of what you're listing has been done and can be found in Boost and or GSL. If learning is your goal, how about write a Qt application that uses some of these math functions?

Simeon Fitch
+4  A: 

Find a problem that you need to solve. Look around to see if a library exists already. If not, then solve it in a way that others can benefit and put the library up on something like github.

But please be prepared to support it if you want to really see it being used - nothing worse than a open source project that isn't well supported.

psychotik
+1  A: 

I'd encourage you to try and come up with an application that would make use of the library. A game, a business app, whatever. Maybe even come up with an application idea first then determine what libraries you would need that aren't readily available.

That way you know you'll be creating something of practical value and not just undertaking a purely intellectual exercise. Try and avoid just plucking a library idea out of the air as you'll inevitably reimplement something that already exists. That's fine for you to learn but it would be awesome if you could create something others could benefit from in the process :)

Also, your application will provide a ready made test for your library.

andyjdavis
+4  A: 

If it is for the sake of an exercise, writing a library to deal with fractions is a good one.

http://en.wikipedia.org/wiki/Fraction_(mathematics)

Implement the basic operations and a way to print them.

Eddy Pronk
A: 

Creating 'toy' level libraries doesn't help much on learning C++. I'd suggest you look at the libstdc++ bugs, try to understand and help fixing some ones.

Lei