Source code objective
I'm trying to figure out what this source code does. I keep on getting an error message.
#include<stdio.h> #include<math.h> double number_array[30]; int count = 0; double calc_sum(); void print_list(); double get_number(); double calc_mean(double *list) { double sum = calc_sum(list); return sum / count; } double calc_std_dev(double *list) { int index = 0; double sum = 0; double mean = calc_mean(list); while (list[index] != 0) { sum += (list[index] - mean) * (list[index] - mean); index++; } return sqrt(sum / (count -1)); } void create_list() { int number = 0, index = 0; do { number_array[index] = get_number(); number = number_array[index++]; } while (number != 0); // if user enter 0, quit count = index - 1; } void read_from_file() { } int main() { create_list(); print_list(number_array); printf("mean = %f \n", calc_mean(number_array)); printf("std dev = %f \n", calc_std_dev(number_array)); } |
please use code tags!!!!
PHP Code:
Code:
printf("mean = %f \n", calc_mean(number_array)); there is no way to help so PLEASE READ the guide on posting http://www.linuxquestions.org/linux/...Ask_a_Question and included the NEEDED information the operating system you are using ? the version of said OS ? the FULL build line you are using and the MOST important part THE ERROR !!!!! |
All times are GMT -5. The time now is 12:26 AM. |