Computing the average of several numbers I am learning C++. This is a simple program I had to write for class. Is there anything I should fix?

#include &lt;iostream&gt;
using namespace std;


int main()
{
    const int ListSize = 5;
    int ValuesProcessed = 0;
    float ValueSum = 0;

    cout &lt;&lt; "Please enter " &lt;&lt; ListSize &lt;&lt; " numbers" &lt;&lt; endl;

    while(ValuesProcessed &lt; ListSize){
        float Value;
        cin &gt;&gt; Value;
        ValueSum += Value;
        ++ValuesProcessed;
    }
    float Average = ValueSum / ValuesProcessed;
    cout &lt;&lt; "Average: " &lt;&lt; Average &lt;&lt; endl;

    return 0;
}
This is quite good for a homework exercise.

I would recommend a for loop instead of the while:

for (int ValuesProcessed = 0; ValuesProcessed &lt; ListSize; ++ValuesProcessed) {


This puts all the logic of iteration together where you are less likely to overlook
some detail, unlike the while loop where the initial value of ValuesProcessed,
the test for termination of the loop, and setting ValuesProcessed for the next
iteration are done in three different places.

I tend to follow the philosophy of declaring things as close to where they are used
as possible, so I would move the declaration and initialization of ValueSum after
the "Please enter" printout. But I don't think there's a strong argument for doing this.
(It would merely swap the order of two lines of code, not a big deal.)

Contrary to another answer, I like your decision to declare ListSize in your main()
function. (It's another example of "declaring things as close to where they are used
as possible".) Although ListSize is a "constant" in the sense that you have declared it
const (which I think is a good idea), it is really just the end condition of a
single loop in the program, or to put it another way, the length of a list of inputs
that the program is about to read.