Hey all, I'm new here.

My little brother came to me for help with some high school programming homework and I've only taken a few college courses on programming and it's kind of out of my reach (sad isn't it?).

He has to read data from a text file setup as such into arrays:

dc[1]

gt[1] snr[1]

gt[2] snr[2]

gt[3] snr[3]

gt[4] snr[4]

gt[5] snr[5]

dc[2]

gt[6] snr[6]

gt[7] snr[7]

Five values of 'gt' with (a corresponding 'snr' value) for each 'dc'. There are 5 dc's. Then he has to send the arrays to a void function to calculate the slope, intercept, and r^2 of the line snr vs. gt for each dc group. So values 1-5 get one slope, intercept, and r squared, then the values 5-10 get a slope...etc etc.

Now you'll see in the code I used nested for loops to get this done, however my slope for the first dc group is correct IN THE FUNCTION but after the loop finishes and the data is sent back to the main program it changes. You can see in the program itself it prints the original data, then a list of calculated data (slope, then intercept, then r^2) from the array, and then it prints the formated table that is in the main program. Can anyone see what is going on here? We really appreciate it.