Section Three Tutorial: 1. Debugging Pointers and References
Section Three Tutorial: 1. Debugging Pointers and References
2. Correlation
The aim of the program correlation.cpp is to find the
correlation between two data samples. One data sample has a list of
heights and other a list of weights. The comments throughout the
code indicate the steps needed to calculate the correlation between
the two data samples. Follow these steps and complete the program.
Ensure that the correlation between the data sets is approximately
0.78.
1
Section Three Tutorial
Notes for Question 1
• Try and remove the bugs that do not involve pointers and references first so that
the more subtle errors are easier to find. Are there differences between the
function declarations and definitions? Are there type errors in the assignment
statements?
• In this program you will use the functions you developed in stats. Remember
that the three functions are in every way like mathematical functions exp() and
sqrt(). All you need to provide is the correct number of input arguments of
the correct type.
• Unlike previous uses of stats the data will be read from a file. The code for this
step is already completed. Just make sure that the file statsfile.cpp is
included in the compilation step.
• Refer to any decent statistics book for the equation for the correlation
coefficient!