the program asks you to input 10 integers in the array and then it adds them up. So far so good.
my problem is that i cant make it to show the numbers entered in a reverse order.
int main() {
int size;
size=9;
int array[size];
int total;
total=0;
cout<<"Enter 10 numbers"<<endl;
for (int num1=0; num1<size; num1++)
{
cin>>array[size];
total=total+array[size];
}
cout<<total<<endl;
for (int num1=size; num1>=0; num1--)
//also did this: for (int size=9; size>=0; size--)
//but same problem.
cout<< array[size];
return 0;
}
Here is the output.
1
2
3
4
5
6
7
8
9
45
9-107374330410741437901073819680110854222010739665841345136181345192161073787046-1073743328
It can read the last number entered but after that it hits the wall.
My assumption is that it reads the last number because of the num1=size but after why it stops?
are the values from the array are being wiped out?
[ September 28, 2002: Message edited by: bazoukas ]