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