#include <iostream>#include <cstring>using namespace std; int main() { string name; double sal, total=0, sum=0; while (cin >> name){ cin >> sal; total+=sal; sum++; } cout << total/sum; return 0;}
Ivanov 100 Smirnov 150 Popov 200 Sokolov 150
150
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!