Floating point type numbers have a limited accuracy: http://en.wikipedia.org/wiki/Floating_point
For your second question use std::cout.precision(x), where x is the max amount of significant digits you want.
If you read the article that BlackSheep provided the link to, you might see a lot of clues. Here is another hint:
Floating point numbers are like this:
FloatValue = DesiredVlaue plus or minus a very small amount. This why 2.3 is 2.2999999. However output functions like cout & printf will do the right thing, so 2.3 to 2dp is 2.30
Google DBL_EPSILON for more info, especially how to compares floats & doubles.
just adding the aswer, the cause is the representation of float in system architeture has limits (4 bytes to be right), so sometimes you cannot take the precission of you want.
But you can say "it's only 2 digits: 2.3, how the system cannot represent this?" Cause the system use the another numerical base: the binary system. That's mean the number 2.3 can be a repeating decimal in binary, so it's never precise and need rounding to work. When you use few times the variable there's no problem, but if is in a for loop then could be a monster like the http://www.ima.umn.edu/~arnold/455.f96/disasters.html