[Solved] Function won’t work as I want them to work (c)


This code doesn’t compile when y and z are not defined. Adding float in front of those variables and altering the path to run this I found the following errors:

First, loading the data into a failed for me:

a[ROW][COLUMN] = {0}

produced a garbage array so I dropped the initialization to get just:

a[ROW][COLUMN]

allowing the data load to work.

The next issue is that you want to treat amount as both a float and an int. In background_radiation() I made an extra arg for the loop and altered the scanf():

scanf("%f", &amount);

int max = (int)amount;
for(i=0; i<max; i++)

After those changes if I enter “12.0” for the amount float, I get the following output:

------ background_radiation ------ 

How many numbers would you like to take an average?
12.0

The average background_radiation:
0.54

average_maximum() can be made to work similarly. beam_width() was probably suffering from data load issues. It appeared to work fine for me.

solved Function won’t work as I want them to work (c)