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

WA 请教

Posted by jmf at 2010-01-24 17:43:40 on Problem 3507
#include <iostream>

using namespace std;

int main ()
{
	int num[6];
	for (int j=0;j<6;j++)
		cin>>num[j];

	while (num[0]!=0&&num[1]!=0&&num[2]!=0&&num[3]!=0&&num[4]!=0&&num[5]!=0)
	{
		int max,min;
		float avg=0;
		max=num[0];
		min=num[0];
		for (int i=1;i<6;i++)
		{
			if (num[i]>max)
				max=num[i];
			if (num[i]<min)
				min=num[i];
		}
		avg=(num[0]+num[1]+num[2]+num[3]+num[4]+num[5]-max-min)/4.0;
		cout<<avg<<endl;
		for (int j=0;j<6;j++)
			cin>>num[j];
	}
	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