    01: #include <iostream>
    02:
    03: using namespace std;
    04:
    05: int main()
    06: {
    07:    double sum = 0;
    08:    int count = 0;
    09:    bool more = true;
    10:    double salary = 0;
    11:    while (salary != -1)
    12:    {
    13:       cout << "Enter a salary, -1 to finish: ";
    14:       cin >> salary;
    15:       if (salary != -1)
    16:       {
    17:          sum = sum + salary;
    18:          count++;
    19:       }
    20:    }
    21:    if (count > 0)
    22:       cout << "Average salary: " << sum / count << "\n";
    23:    return 0;
    24: }