Hey. i'm making this program right now, and I KNOW what the problem is, but I don;'t know what I did wrong. All the functions and everything work correctly, so no need to worry about those, but I'm pretty sure I screwed up SOMEWHERE in my switching. Everytime I slect a number, ALL possible entries take place. Entries 1-11 and 99. Can anyone see my problem? i've been debugging the crap out of this thing to no avail.

OMG! NEVERMIND! I can't believe I was so stupid I didn't put BREAK in there!


Code:
int main ()
{
FILE *fp;
double array[100];
int selection=0, num=0, count=0, column=0;



while (selection != 99)
{
printf("1- Read from arraynumbers1.txt \n");
printf("2- Read from arraynumbers2.txt \n");
printf("3- Read from arraynumbers3.txt \n");
printf("4- Sort in ascending order \n");
printf("5- Sort in decending order \n");
printf("6- Calculate the sum \n");
printf("7- Calculate the average \n");
printf("8- Calculate the Minimum \n");
printf("9- Calculate the Maximum \n");
printf("10- Display the array in 1 columns \n");
printf("11- Read from arraynumbers3.txt \n");

printf("Enter Selection: \n");
scanf("%i", &selection);


switch(selection)
{
case 1:
{
fp = fopen("arraynumbers1.txt", "r");

if ( fp == NULL )
{
printf("File could not be opened\n\n");
return 1;
}

num=0;
while (fscanf(fp, "%lf", &array[num]) != EOF)
num++;

printf("%i numbers were read from arraynumbers1.txt. \n", num);

}

case 2:
{
num=0;

fp = fopen("arraynumbers2.txt", "r");

if ( fp == NULL )
{
printf("File could not be opened\n\n");
return 1;
}

while (fscanf(fp, "%lf", &array[num]) != EOF)
num++;

printf("%i numbers were read from arraynumbers2.txt. \n");
}

case 3:
{
num=0;
fp = fopen("arraynumbers3.txt", "r");

if ( fp == NULL )
{
printf("File could not be opened\n\n");
return 1;
} 

while (fscanf(fp,"%lf", &array[num]) !=EOF)
num++;

printf("%i numbers were read from arraynumbers3.txt. \n");
}

case 4:
{
if (num==0)
printf("Please select 1-3 first. \n");

else
{
dsort(array, num, 0);

printf("The New array is:");

for (count = 0; count<num; count++)
printf("%.2lf ", array[count]);

printf("\n\n");
}

case 5:
{
if (num==0)
printf("Please select 1-3 first. \n");

else
dsort(array, num, 1);

printf("The New array is: \n");

for (count = 0; count<num; count++)
printf("%.2lf  ", array[count]);

printf("\n\n");
}

case 6:
{
if (num==0)
printf("Please select 1-3 first. \n");

else
printf("sum=%.2lf", dsum(array,num));

printf("\n\n");
}

case 7:
{
if (num==0)
printf("Please select 1-3 first.\n");
else
printf("average=%.2lf", daverage(array,num) );

printf("\n\n");
}

case 8:
{
if (num==0)
printf("Please select 1-3 first.\n");
else
printf("maximum=%.2lf", dmax(array,num) );

printf("\n\n");
}

case 9:
{
if (num==0)
printf("Please select 1-3 first.\n");
else printf("minimum=%.2lf", dmin(array,num) );

printf("\n\n");
}

case 10:
{
if (num==0)
printf("Please select 1-3 first.\n");

else
{
for (count = 0; count<num; count++)
printf("%.2lf \n ", array[count]);
}

printf("\n\n");
}

case 11:
{
if (num==0)
printf("Please select 1-3 first.\n");

else
{
for (count = 0, column = 0; count<num; count++, column++)
{
if(column==2)
{
printf("\n");
column = 0;
}
printf("%.2lf    ", array[count]);
}
}
printf("\n\n");
}


case 99:
printf("Thank You and Come Again.\n");

default:
printf("Invalid Entry. Please Try Again.\n");
}

return 0;
}
}
}