I need to calculate the mean and standard deviation of 16 house prices. The data is being read in from a text file. The program compiles, but it does not correctly calculate the mean and standard deviation. Could this be a read in mishap or is something wrong in my calculation? Please help
I made sure the file was opening properly and it was. I also made 2 separate functions to calculate the mean and standard deviation but I'm still getting weird numbers for my mean and standard deviation. When I run it I get:
This program calculates the mean and standard deviation of house prices.
Standard Deviation: 6.94649e-310
Mean: 6.94649e-310
You are never using the return value of your calcMean function.
The mean variable in main is never set to anything.
mean = calcMean(num);
Same thing for stdDev. You are never assigning a proper value to it. You should turn on compiler warnings in your IDE or compiler, because they would flag things like this as "uninitialized variable" warnings.
stdDev = calcDev(num, mean);
Also, you can declare and initialize variables on the same line.