Starting from the top:
Globals are bad enough, but globals named n, m, i, etc? That's a shooting offence. Why do you even have a class?
line 44: you don't have an array named x
None of your globals are initialised, so when you do stuff like
You end up with nonsense values. Ask yourself, what is the value in sumY to start with? You never gave it a value (0 would have been nice), so it contains nonsense. You can't possibly get any meaningful values from calculations based on these.
for (i = 1; i <= m; ++i){ |
Imagine m == 4, you would have an array like y[0], y[1], y[2], y[3] - now, by starting with i = 1, you've skipped the first element. By proceeding until i=m, you've accessed outside the bounds of your array. This is undefined behaviour, and the best you can hope for is wrong data, but you're likely to experience a segmentation fault