+2  A: 

DON'T use floats for financial data, EVER.

This will get you into all kinds of rounding and precision problems, and you DON'T want them in data that describes money sums. Unless you like getting sued, of course :).

Either use integer types or create a fixed-point type.

Also, don't use system(), if possible. This is inherently non-portable, not to mention being slow and ugly.

Until you fill up more code, this is about all that I can tell you. Good luck!

slacker
I actually consider that float comment as bad advice. Not in general, just the "EVER" bit. It actually requires the adding/subtracting of a *huge* quantity of values for errors to propagate up to the 1/100 fractional place. They propagate faster for multiplication but it's still a lot of operations needed for it to become noticable. And, for homework, there's *nothing* wrong with using floats - as an educator, I'd be pretty suspicious of plagiarism if someone handed in an assignment with a money handling class :-)
paxdiablo
@paxdiablo:Sir, I don't think you would tolerate ANY error on YOUR payroll :). Money sums have to be kept exact, period. You don't want `0.70+0.10 >= 0.80` to fail, for example. <joke>The IRS may send you to Guantanamo for that.</joke> Also, the number of excess bits in a single-precision float is not that much, especially if the value grows high.As an educator, **I** would reject any assignment which did something so egregious as keeping a money value in a `float`.And writing a fixed-point number class is very easy, really.
slacker
I've got to second Slacker here. I've had a lot of trouble with roundoff errors over the years. It's very easy to multiply by a large number, then subtract a large number, and get stuck with the roundoff errors. Higher precision libraries can help somewhat (128/256/512/1024 bit floating point). But nothing beats good code. Fixed point is exactly what's needed for money. (Unless you are tracking fractions of the cents...)
Mr.Ree
Slacker makes a good point. If you find yourself doing intrest calculations which would result in numbers outside of the precision of the number of decimals you have round them down and then transfer the tiny extra bits of money to your own account.
stimms
@slacker, I very much *would* tolerate errors on my payroll, provided they're small enough to not actually affect the results. What I was saying is that, provided you understand how floats work, use of them is fine. *Especially* in a company with only three employees where you're only calculating one weeks wage. This level of classwork does not (in my opinion) need the use of a decimal type. However, I was just pointing out a disagreement with one small part, I didn't feel strongly enough to downvote. I may well have upvoted except for that advice.
paxdiablo
I appreciate the feedback and I know it was a lot to read through. My work schedule makes it tough for me to do these assignments on time, and it's even tougher to procrastinate...grr. let's hope I at least make a C on this assignment so I can get an A overall... Wish me luck!