I'm a beginner in C++ so please bear with me. Below is just a part of the full program.
When the user inputs the first number (assume '3'), it goes to the if statement. a[count ++] then becomes a[1] (if I'm not wrong, because count is initially 0). The array element a[1] thus stores the input which is 3. If so, then didn't the program just skip a[0]?
int readarray(int a[], int capacity) {
int count = 0;
int input;
do {
cout << "Enter a number (-1 to stop): ";
cin >> input;
if (input != -1) {
a[count++] = input;
}
} while (input != -1 && count << capacity);
return count;