About Question enthuware.ocajp.i.v7.2.1154 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
bptoth
Posts: 33
Joined: Mon May 06, 2013 9:41 am
Contact:

About Question enthuware.ocajp.i.v7.2.1154 :

Post by bptoth »

The explanation regarding the int,int answer says as follows

a*10/4.0; generates a double so, A2's m1() cannot return an int. ( It will need a cast otherwise: return (int) a*10/4.0; )

However, with this form of casting there still seems to be compilation error (cannot convert from double to int)
My understanding is that since the casting operator precedence is higher than that of * and / operators, thus it only concerns 'a' (which is already an int) and then there is int divided by double again

So I suppose it should be return (int) (a*10/4.0); with parentheses?

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocajp.i.v7.2.1154 :

Post by admin »

You are right. This has now been fixed. Thank you for your feedback!
Paul.

Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests