raptr_dflo 48 Posting Pro

Hi andy,
While helpful, sergent and mike missed the original problem: your main() failed to call p1.setDistFrOrigin() before printing it, so you were getting whatever garbage happened to be in that memory location.

Also, if I recall correctly, since pow() is written to support non-integer exponent values, it's not necessarily very efficient. For Point2D, just use sqrt(x*x + y*y), and for Line2D, consider using a couple of temporary values to make your expression more readable.

raptr_dflo 48 Posting Pro

Sorry, I guess that was it in the first comment.

There are a couple obvious problems in your "case 1" for creating a new account. You don't check the value of i, so you'll get an error if you try to add an account if i >= 10. Also, you increment the value of i first, so you have an account a[0] which you never use.

In your newaccount() method, you increment the instance member accno (which may or may not be initialized to zero -- if it is, then your accno will always be 1, otherwise it will be some arbitrary value), and ignore your static class-member (which I think you intended to provide successive new account numbers).

Your transfermoney() method also has problems -- first of all, you add the money to the destination account before you determine whether the source account has sufficient funds. Also, instead of copying the destination account into the method, and then copying back via assignment, consider passing a pointer to the destination account, and modifying it directly as needed in the method.

In case 5, where did the "b" variable come from?

raptr_dflo 48 Posting Pro

And did you have a question to go with your code?

raptr_dflo 48 Posting Pro

If you look at your own code objectively (which is hard when you're in a blind panic about finishing an assignment on schedule), you'll see that you're running your grade-input-loop four times, and in each time through the loop, you're asking for each of four grades. Do one or the other, and your problem will be solved! (Hint: since you're keeping separate arrays for the grades, I'd recommend getting rid of the inner loop. ;) )

raptr_dflo 48 Posting Pro

> but my key '596' is present in 'map_dict2'.

but according to the error, it's not present in map_dict1. Check for that using map_dict1.has_key(key) (or the new and preferred "key in map_dict1") before checking whether the value at that key equals the expected value.

novice20 commented: U showed me the right direction :) +3