Multiply the decimal value by 10eN where N is the number of digit places.
Add .5 * SIGN to the value, where SIGN is the sign (-1 or 1) of the value.
Truncate the decimal.
Divide the value by 10eN, where N is the number of digit places.
I used pseudocode because I didn't want to spoil your fun.
If you are using floating point variables to store the numbers then rounding may not help you: there might not be enough precision, depending upon the type you're using and the decimal place you want to round to, to hold the rounded value....