Hello, I am a new programmer and have been learning it pretty well on my own for a while. I was recently given an assignment using arrays and ran into a problem. I was hoping that someone could please give me a hint and let me know where I went wrong because I've written most of the code already and want to complete it myself. I've written it many different ways but am not sure if something is wrong with the program or/and the formula. I know that it is something so small that I am overlooking; unfortunately I am 100% comfortable with how arrays work yet but am definitely trying to learn. Any help would greatly be appreciated

The program is basically supposed to calculate the distance an object travels from when it is dropped. It also prompts the user for time (seconds it has been dropped from-1 to 10) then it prints out the users results as well as the results for the other seconds (1-10).

Formula I am using is

d=.5*g*t*t

g=9.8m

t= the number user enters between 1-10

I have been able to get the program to compile successfully, unfortunately the same cannot be said about the results. The output should resemble

Second Traveled (m)

1 4.9

2 19.6

.......

5 122.5

......

10

My program doesn't calculate the values for the array correctly and I cannot figure out why. It will correctly calculate the distance for the number that the user enters (e.g. 1 second will be 4.9 meters) but incorrectly for the other seconds. Please let me know if you have any ideas as to what I am doing wrong.

Thank you so much

Code:`#include<iostream.h>#include<iostream.h>`

#include<iomanip.h>

int main()

{

const int arraysize=10 ;

double d[arraysize];

int t;

double tot;

cout<<"Please enter the travel time\n";

cin>>t;

for (int i=0; i<arraysize; i++)

d[i]=.5*9.8*t*+i;

cout<<" Time"<<setw(13)<< " Distance Traveled"<<endl;

for (int j=0;j<=t;j++)

{

tot =d[j];

cout<<setw(9)<<j<<setw(13)<<tot<<endl;

}

for (int s=j;s<=arraysize;s++)

{

cout<<setw(9)<<s<<setw(13)<<tot<<endl;

}

return 0;

}