I have some problems with this program that does very basic calculations.
I have deleted all the menu code i dont think is needed.
#define true 1
#define false 0
void calcEPS (void)
printf("\n\n\n\n FUNDAMENTAL ANALYSIS TEST PROGRAM\n");
printf("\nPlease enter the name of the company: ");
printf("\nhow many would you like to calculate? : ");
for (i= 0; data.total > i; i++)
printf("\n\n EPS %d ", counter);
printf("\n Earnings Per Share\n\n");
printf("Please enter the net profit after tax(NPAT): ");
printf("\nPlease enter the number of shares on issue: ");
data.eps[i] = data.npat[i] / issue;
printf("\nthe last %d calculations for %s are", name, counter);
for (i = 0; data.total >i; i++)
printf("\n%d EPS is %0.5f ", counter, data.eps[i]);
printf ("\n\nPress [Enter] to continue");
while ((ch = getchar()) != '\n' && ch != EOF);
I have a few problems.
1) the program crashes after doing a few large EPS calculations. I am using floating point data type which i thought could handle the large numbers..maybe not?
2) related to #1 my array
maybe im mistaken how arrays work, but i only want a max of 5 years to be stored (i know this is not checked). But it seems when if i make it float eps, or float eps the program can handle more calculations before crashing.
3) I cant seem to get the name to display correctly, it is all garbage. not sure why this doesnt work as the function works perfectly as a seperate program.
sorry for the long post, any help would be appreciated.