I am trying to enter at least 5 and not more than 10 values in an array. When the user enters -1, the program ends. -1 should not be included in array. The array can only hold 10 values. if the user enters only 5 values the rest should be set to 0. I am having trouble with the number of values the user enters.
int num;
int numOfInt = 0; //number of values entered by user
int array[10];
cout << "enter values: ";
do
{
cin >> num;
array[numOfInt] = num;
numOfInt++;
if (num < 0)
{
numOfInt--;
}
} while (numOfInt >= 5 && numOfInt < 10 && num > 0);