My program is working but the output isn't displaying as it should.
Here's the INPUT:
62 61 59 64 60 54 57 53 60 55
And this is how the OUTPUT should display:
Current heights: 62 61 59 64 60 54 57 53 60 55
Expected heights: 65.1 64.05 61.95 67.2 63 56.7 59.85 55.65 63 57.75
Any help fixing this issue would be appreciated. Here's my code:
#include <iostream>
usingnamespace std;
int main()
{
double height[10];
double expHeight[10];
for (int x = 0; x < 10; x = x + 1)
{
height[x] = 0.0;
}
cout << "You are asked to enter heights (in inches) of 10 students. " << endl << endl;
for (int x = 0; x < 10; x = x + 1)
{
cout << "Enter the height of a student: ";
cin >> height[x];
expHeight[x] = height[x] * 1.05;
}
for (int x = 0; x < 10; x = x + 1)
{
cout << "Current heights: " << height[x] << endl;
cout << "Expected heights: " << expHeight[x] << endl;
}
system("pause");
return 0;
}