If you are familiar with MATLAB, there is a k-mean function in matlab. If you plan to use C/C++, you can look at the book called numerical recipe in C to get k-mean c-function.
k-means in general is fairly simple to implement.
The results of the algorithm depend a lot on your parameters.
First off, finding true k is essential.
Use a cross validation with a scree plot to find the true k.
k-means tends to be sensitive to the random clusters generated at the start of the algorithm.
So run it several times to find the best result.
Also consider Fuzzy k-means or even EM algorithm (depends on how much noise you have and the origin of the data).