First off a little tip for your for loops. You are currently writing them like this
1 2
|
int i;
for (i = 0; i < 5; i++)
|
But you can write them like this
for (int i = 0; i < 5; i++)
Both examples work almost the same way. Notice that I'm declaring my index
int i;
inside the for loop. Now the only difference is that when you declare the variable inside the for loop it disappears when the loop is done, so you will no longer be able to use that variable after that.
Like I said both work almost the same, but it is more common to put it inside the for loop. Anyways now on to the problem.
Somethings I noticed
1) you declare bSize but you don't initialize it to anything. You are also passing it to your function but you don't use it in your function anywhere. When I say you don't use it I mean you don't use the
int size
parameter in your function.
2) The reason why you are getting a random output when you enter decimal numbers is because you are trying to enter a decimal into a integer array. To fix this you need to change your array to a double type like
double bRay[5]
, and change your function to accept a double as a parameter, and everything else that deals with the array.
That should fix up the problems so far and leave you to working on rounding up to a whole number part.