What I am trying to do is populate an array and then ouptut the contents. I tried this code and it doesn't work...
I tried to use this to populate the array:
1 2 3 4 5 6 7
for (i=0; i<k; i++)
{
cout << "Enter a number: ";
cin >> numbers[k];
}
and then use this to display the contents of the array:
1 2 3
for (j=0; j<k; j++)
{
cout << numbers[k] << ", ";
When I use that what I get is the last number I entered into the array instead of each number I entered. Does anyone know what I am doing wrong?
Thanks.