// Statistics.cpp : Defines the entry point for the console application. // #include "stdafx.h" #define DATASIZE 20 #define NO 0 #define YES 1 void print_m(void); float get_mean(float data[], int size); float get_min(float data[], int size); int _tmain(int argc, _TCHAR* argv[]) { float data[20] = {1.2, 8.9, 3.1, 2.3, 3.1, 4.1, 5.9, 6.2, 3.4, 2.7, 1.6, 1.9, 2.1, 8.4, 2.2, 2.3, 5.4, 6.5, 7.1, 9.0}; int option, continue_key; float x, y; int n, j; char c, cc; do{ print_m(); scanf("%d", &option); switch(option){ case 1: printf("\n\nMean Value = %f\n\n", get_mean(data, DATASIZE)); printf("Press to continue:\n\n"); c = getchar(); while( ( c = getchar() ) != '\n') cc = c; break; case 2: printf("\n\nMinimum Value = %f\n\n", get_min(data, DATASIZE)); printf("Press to continue:\n\n"); c = getchar(); while( ( c = getchar() ) != '\n') cc = c; break; case 0: break; default: break; } } while (option != 0); return (0); } void print_m(void) { int i; for(i=1; i<40; i++) printf("\n"); printf("Menu of a lot of Statistics functions...\n\n"); printf("Option Action\n"); printf("------ ------\n"); printf(" 1 Compute Mean Value of Data Set \n"); printf(" 2 Compute Minimum Value of Data Set \n"); printf(" 0 End This Program \n\n\n"); printf("Enter option 1 ... 2, or 0 to STOP\n\n"); return; } float get_mean(float data[], int size) { float mean_value = 0; float sum = 0; int i; for(i=0; i