I've been trying to figure out the "too much initializer" problem for hours, but all the solutions I tried leads to a dead end.
Here is the code:
#include
#include
using namespace std;
float compute_avewil(const int low_value[30], const int high_value[30])
{
float average[29];
average[0] = high_value[0] + low_value[0] / 2.0f;
float a = average[0];
average[1] = high_value[1] + low_value[1] / 2.0f;
float b = average[1];
average[2] = high_value[2] + low_value[2] / 2.0f;
float c = average[2];
average[3] = high_value[3] + low_value[3] / 2.0f;
float d = average[3];
average[4] = high_value[4] + low_value[4] / 2.0f;
float e = average[4];
average[5] = high_value[5] + low_value[5] / 2.0f;
float f = average[5];
average[6] = high_value[6] + low_value[6] / 2.0f;
float g = average[6];
average[7] = high_value[7] + low_value[7] / 2.0f;
float h = average[7];
average[8] = high_value[8] + low_value[8] / 2.0f;
float i = average[8];
average[9] = high_value[9] + low_value[9] / 2.0f;
float j = average[9];
average[10] = high_value[10] + low_value[10] / 2.0f;
float k = average[10];
average[11] = high_value[11] + low_value[11] / 2.0f;
float l = average[11];
average[12] = high_value[12] + low_value[12] / 2.0f;
float m = average[12];
average[13] = high_value[13] + low_value[13] / 2.0f;
float n = average[13];
average[14] = high_value[14] + low_value[14] / 2.0f;
float o = average[14];
average[15] = high_value[15] + low_value[15] / 2.0f;
float p = average[15];
average[16] = high_value[16] + low_value[16] / 2.0f;
float q = average[16];
average[17] = high_value[17] + low_value[17] / 2.0f;
float r = average[17];
average[18] = high_value[18] + low_value[18] / 2.0f;
float s = average[18];
average[19] = high_value[19] + low_value[19] / 2.0f;
float t = average[19];
average[20] = high_value[20] + low_value[20] / 2.0f;
float u = average[20];
average[21] = high_value[21] + low_value[21] / 2.0f;
float v = average[21];
average[22] = high_value[22] + low_value[22] / 2.0f;
float w = average[22];
average[23] = high_value[23] + low_value[23] / 2.0f;
float x = average[23];
average[24] = high_value[24] + low_value[24] / 2.0f;
float y = average[24];
average[25] = high_value[25] + low_value[25] / 2.0f;
float z = average[25];
average[26] = high_value[26] + low_value[26] / 2.0f;
float aa = average[26];
average[27] = high_value[27] + low_value[27] / 2.0f;
float ab = average[27];
average[28] = high_value[28] + low_value[28] / 2.0f;
float ac = average[28];
average[29] = high_value[29] + low_value[29] / 2.0f;
float ad = average[29];
average[30] = { a,b,c,d };
cout max)
{
max = average[i];
}
}
}
int main(float average[30], int n)
{
int id_number[30] = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30 };
int high_value[30] = { 10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200,210,220,230,240,250,260,270,280,290,300 };
int low_value[30] = { 1,2,3,4,5,6,7,8,9,10,9,8,7,6,5,4,3,2,1,0,1,2,3,4,5,4,3,2,1,0 };
compute_avewil(low_value, high_value);
find_highthat(average, n);
}
I am also trying (and failing) to find solutions for the
int find_highthat(float average[30],int n,float id_number)
{
int i;
int max = average[30];
for(i=0;i<n;i++)
{
if(average[i]>max)
{
max = average[i];
}
}
}
solution, whats supposed to happen is that the array from the function above this should go to this function and it should get the greatest value in the array, I should also make another function that gets the opposite of the greatest value from the same array.
What I have tried:
I tried researching and coming up for my own solutions for hours on these problems, and the results either don't work or there is usually something wrong with the code that i cannot solve.