fork(1) download
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. int main() {
  6. string name;
  7. double sal, total=0, sum=0;
  8.  
  9. while (cin >> name){
  10. cin >> sal;
  11. total+=sal;
  12. sum++;
  13. }
  14.  
  15. cout << total/sum;
  16.  
  17. return 0;
  18. }
Success #stdin #stdout 0s 4288KB
stdin
Ivanov   100
Smirnov  150
Popov    200
Sokolov  150
stdout
150