Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:谁能帮我看看吗,怎么都过不去!In Reply To:谁能帮我看看吗,怎么都过不去! Posted by:wujitianya at 2007-11-17 14:29:54 而且好像是输出小数点后两位数字,你末尾有0的话就不输出了 > #include <iostream> > using namespace std; > > int main() > { > double m_month; > int i=0; > int temp; > double sum=0; > double average; > > while (i!=12) > { > cin>>m_month; > sum+=m_month; > i++; > } > average=sum/12+0.005; > > temp=(int)average;//integer > temp=(int)((average-temp)*100); //decimal > average=(int)average+(float)temp/100; //average > > cout<<average<<endl; > return 0; > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator