http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1048
题意:
输入12个月的工资,求平均值。输入两位小数点。水
#include <iostream>
#include <iomanip>
#include <stdio.h>
using namespace std;
int main()
{
int iMonth = 12;
double sum = 0;
double tmp;
while ( iMonth-- )
{
cin >>tmp;
sum += tmp;
} // end while
cout <<fixed <<setprecision(2) <<"$" <<sum/12 <<'\n';
return 0;
}