Printing part of an array

I Have this assignment that wants me to print out up to a certain limit of an array; basically the array is filled up by the user and i dont knw how many times did he fill ...so when the user prints the array its just printed up to the limit he eneterd ...CAN any one please help me do this ????
Do you mean a value is used to signify the end? Just have the loop continue while the current item does not equal the limiting vale. for example
1
2
3
4
// get values from user till they enter -1;

for (int i = 0; array[i] != -1; ++i)
    cout << array[i];
Last edited on
Topic archived. No new replies allowed.