#include <iostream>
#include <cstdlib>
usingnamespace std;
int main()
{
int input[10];
input[0] = 0;
input [1] =0;
input [2] =0;
input [3] =0;
input [4] =0;
input [5] =0;
input [6] =0;
input [7] =0;
input [8] =0;
input [9] =0;
for(int i=0; i<10; i++)
{
cout<<"Please enter a number."<<endl;
cin>>input[i];
}
cout<<"The numbers entered in reverse order are:"<<endl;
cout<<endl;
for (int w=10; w>0; w--)
{
cout<<input[w]<<endl;
cout<<endl;
}
}
Everything works fine, except when it outputs the input in reverse order, the first number output is way off and the last number that should be output never is. What am I doing wrong?
Also, in this course I am NOT allowed to use functions of any kind.