Another quick C++ question
So double can be both integers and decimals right: like 5 would be 5.0 what if i had a decimal 6.3333333333333 How many threes would it keep?
I know a bit of java, so maybe I can help you if you're lucky.
no this is just basic stuff.. Like that's my question technically how many decimals would "double" data type keep?
check out this page.. hope it helps http://www.cplusplus.com/doc/tutorial/variables/
It would be a few, but not infinitely many. With floating point numbers you will often not get 'exactly' what you try to store there.
You will have a little bit of error. Which is why these sorts of things are not good for money.
oh okay. But for basic stuff this is good enough right? Say I just wanted to write a basic program for calculating area.
tnx a lot guys! =)
It'll be fine for that.
Yep, fine for area.
The double can have ~6 digits. In other words if you write: double a = 6.333333333333333 it will show you: 6.33333 double a = 33.333333333 it will show you: 33.3333
Join our real-time social learning platform and learn together with your friends!