Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:谁能帮我看看吗,怎么都过不去!

Posted by snakemajia at 2007-11-17 16:38:34 on Problem 1004
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator