Click here to Skip to main content
16,023,117 members

Comments by SAMBA ANGELES (Top 1 by date)

SAMBA ANGELES 22-Nov-23 16:34pm View    
average[30] = { a,b,c,d };

cout max)
{
max = average[i];
}


For this piece of code:
average[30] = { a,b,c,d };

The array was for putting stuff in the array itself, you see the array itself was only supposed to have the averaged solution of the high_value and low_value arrays. I did that by individually assigning the average indices to a solution between two indices between the high_value and low_value arrays.For example average[29]=high_value[29]+low_value[29]/2. I did this for the 28 other indices for those 3 arrays. The indices of the average[] array might be filled, but there was no content in the average[] array itself, so i decided to assign the individual solutions to float variables.For example:

average[29]=high_value[29]+low_value[29]/2;
float y= average[29];

I did this for the other indices as well. My plan was to put all the float variables in the average[] array, but then the initializer error came and halted my progress.

For this piece of code:
cout max)
{
max = average[i];
}

It was one of the solutions I had to find the greatest value in the average[] array. It didn't work out and the result is this post asking for help on those problems

Also to answer the question why I individually assigned the indices even though I could have used a for loop, its because I thought it would be more accurate for some reason. The prompt was to write a function that calculates each individual index in the high_value[] array with the low_value[] array and divide the sum by 2. I thought it would be more accurate to do that with each individual index of each array. It looks like I was wrong. I could tell about the prompt that our professor gave us if it still does not make sense.