here is the main functions code so that I can better explain what is expected of the program
Code:
int main() {
float data[SIZE];
int count = 0;
int choice;
printf("Mini-Statitics Package\n");
printf("----------------------\n");
do {
printf("\nThis program will perform the following\n");
printf("1) Enter data\n");
printf("2) Display the data and the following statistics: \n");
printf(" the number of data items, the high and low values in the data,\n");
printf(" the mean, median, mode, variance and standard deviation.\n");
printf("3) Quit the program\n");
printf("\nYour choice? ");
scanf("%d", &choice);
getchar();
switch(choice) {
case 1: getData(data, &count);
break;
case 2: displayStatistics(data, count);
break;
case 3: printf("Thank you and good bye!\n");
break;
default: printf("%d is not a valid choice\n", choice);
}
} while (choice != 3);
return 0;
}
there is an array of floats which is 200 positions. The user can enter as many as they like as long as they don't go over 200 values. The user signals they are done by pressing Ctrl-d and hitting enter. This brings them back to the menu where they can then display the info on the values. If one value is entered it works fine, no mode gets displayed. If I then enter another value, say the first was 1 , I choose to display, I choose to enter in more values, I enter 1 , I choose to display, that displays the mode as 1, which tecnically it shouldn't because the array only contains two ones, there is no greatest amount of values in comparison to others. Now I choose to enetr the number 2. The array now contains 1 1 2. I display and it tells me no mode which is incorrect because the mode should now be 1 , because in comparison the the three values ,1 appears more time then 2. By specification I have to display no mode if there is no mode present.
edit: when the user enters in data after exiting out of the first entering data choice, the data gets entered right after the previous data