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 |
录入名字时候,要注意清除旧的数据,不然只是覆盖原来,名字有长短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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator