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

录入名字时候,要注意清除旧的数据,不然只是覆盖原来,名字有长短

Posted by L18 at 2008-02-27 16:33:20 on Problem 1547
In Reply To:错在哪里啊。不知道帮我看看吧。大牛们 Posted by:tw_126 at 2008-02-01 03:38:46
#include<iostream.h>
#include<string.h>

int main()
{
	int n;
	char x[10][9]; //数组开大到[10][9],留最后一位结束标志符的位置
	int a[10],b[10],c[10];
	int max,min;
	int d;
	int j=0,m=0;
	cin>>n;
	while(n!=-1)
	{
		max=0;
		min=250;	
		j=0;
		m=0;
		for(int i=0;i<n;i++)
		{
                        //每次的测试的名字有长短,所以用'\0'清除原来数据
                        memset(x[i],0,sizeof(char)*9); 
			cin>>a[i]>>b[i]>>c[i]>>x[i];
		        d=a[i]*b[i]*c[i];
			if(d>max)
			{
				j=i;
				max=d;
			}
			if(d<min)
			{
				m=i;
				min=d;
			}			
		}
		cout<<x[j]<<" took clay from "<<x[m]<<'.'<<endl;
		cin>>n;	
	}
	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