Logical error

What is logically wrong with this code fragment??

 
  double x = 4/3


I think the way to fix this 2ould be to use a const, but I'm not sure what the logical error is in the first place. Why won't the original code work. I'm massive noob so please explain!!
Try:
 
double x = 4/3.0;


you have integer division issues (google it).
also google "c++ static_cast"
Last edited on
Topic archived. No new replies allowed.