Initialized arrays

If you have an initialized array that holds 9 numbers. And you want the program to prompt a user to input another number for the array to hold. Is this possible?
In output I get the 9 initialized numbers and then 0 instead of the number I tried to input.


int Num[10] = {1, 2, 5, 6, 9, 11, 35, 87, 55};

cout << "Enter a number";
cin >> num[10];


for (int count = 0; count < 10; count++)

{
cout << "number " << (count+1) << ": "<< num[count] << endl;
}


Thanks in advance.
You should change cin >> num[10] into cin >> num[9]
Remember that arrays indices are zero based
Hey much appreciated. I'll look over array indices.

Cheers,

joey
Topic archived. No new replies allowed.