Try to place your code between code tags [ code ]code here[ /code ] (spaces have to be removed), it makes code to be highlighted and preserves code format (spaces, tabs, ...)
Your code is too confusing :-(
For example, you are using the variable
row as a
main function variable in two different
for loops. Thus, when you've broken out from the second loop the row is equal to 3 and the fist loop is not going to continue execution (cause` the clause is "row <= 2" and 3 is greater than 2).
I recommend you to make use of internal loop variables, to declare variables in
preexecution statement of a for loop.
1 2 3
|
for(int row =0; row <=2; ++row) {
//code goes here
}
|
Such a code helps you to avoid confusing loops as you've written.
You, also, using an uninitialized variables
avrg and
sig. In some situations it could lead to unpredictable things. I believe, using an uninitialized variables is a bad practice. However, it is just my humble opinion.
About your calculation mistakes.
i) As I can see from your 'right output' you are to calculate standard deviation, so you has to calculate
average squares then to take a root, while you are calculating something else, the sqrt() call is misplaced.
ii) Moreover, as a result of your
confusing loops you are calculating the standard deviation of the second and the third columns using the average of the fist one.
I apologise for any grammar mistakes you may find in my posts. Still, I suppose they are understandable.