参考:https://www.cnblogs.com/BTMaster/p/3525008.html
1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 using namespace std; 5 int main() 6 { 7 float a,sum; 8 while (cin>>a)//要注意格式,能从文件读入多组数据! 9 { 10 sum=a; 11 for (int i=0;i<11;i++) 12 { 13 cin>>a; 14 sum+=a; 15 } 16 cout<<'$'<<sum/12<<endl; 17 } 18 19 return 0; 20 }