المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Populate An Array With Numbers.



C++ Programming
01-08-2011, 03:32 PM
I am having problems with populating an array with int numbers. Since I am a new programmer, I do not know why my VS 2008 is not completing the code block. In other words when I execute the program, a blank console screen opens. I then input a number and press enter. After I press enter the program stops in a suspended state. What I have discovered is that I have to input a \o for the program to know that it is the end of my input. I though thought that when I pressed enter, VS 2008 would automatically place this end of string designator.

Secondly, I have problems with index variable. When I loop one time or when I press enter after inputing a number, my index number advances to 8. My question is why the index does not advance to 2?

#include int const limit = 8;
int numbers[limit];

int main(void)
{
for(int index = 0; index <span class="code-keyword">