The program is supposed to create a class to store information about different archery shots, then compare two shots to find the one with the closest distance to the bulls eye.
I've implemented the class and everything compiles, however my x and y values will not update when the user enters data.
Any pointers toward my mistake will be much appreciated!
Actually the x and y values are updating, but distance is not.
Also default constructor will always create x = 0, y = 0, distance = 0 which is ok but printing them doesn't make sense
I printed them as a way to check if they were updating at the end of the user input. They are both printing out as 0, regardless of input. After I figure out what I've messed up, the print lines will be deleted.
Why would the distance not be updating? Am I not allowed to run an equation like that during the constructor?
Line 30: You're computing the sqrt of (0*0 + 0*0). You might as well just assign 0 to distance.
Lines 37,39: You're accepting new values of xVal and yVal. Where does distance get updated after inputing the new values? Hint: Copy line 30 and place it after line 39.
Am I not allowed to run an equation like that during the constructor?
You're not calling the constructor when you input new values. You're in read().