double arrays c++

I am having a really tough time figuring this one out. This is what I have so far but my calculation for expected height does not work for all of the inputs.

#include <iostream>

using namespace std;

int main ()
{
double height [10];
double expectHeight [10];



for (int x = 0; x < 10; x = x + 1)
{
height[x] = 0.0;
}


for (int x = 0; x < 10; x = x + 1)
{
cout << "enter current height of child " << x + 1 << " : ";
cin >> height[x];

}
cout << " The expected height of the children " << endl;

for (int x = 0; x < 10; x = x + 1)
{
expectHeight[x] = 0.0;


expectHeight[x] = height[x] * .05 + height[x];


}

for (int x = 0; x < 10; x = x + 1)
{
cout << " Child " << x+1 << " Height " << height[x] << " Expected height " << expectHeight << endl;
}

system ("pause");
return 0;
}
You need to display "expectHeight[x]" and not "expectHeight".
Topic archived. No new replies allowed.