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 |
为什么是Compile Error,大侠帮帮忙#include<iostream> #include<math.h> #define PI 3.1415926 using namespace std; struct point { float x; float y;float z;int w; }; void paixu(point *a,int n) {for(int i=0;i<n-1;i++) for(int j=i+1;j<n;j++) if(a[i].z>a[j].z) { point c;c=a[i];a[i]=a[j];a[j]=c; int k;k=a[i].w;a[i].w=a[j].w;a[j].w=k; } } void zezhang(float &r) {float w=r*r*PI+100; w=w/PI; r=pow(w,0.5); } int main() {point a[10]; int n; cin>>n; for(int i=0;i<n;i++) { cin>>a[i].x; cin>>a[i].y; a[i].z=pow(a[i].x*a[i].x+a[i].y*a[i].y,0.5);a[i].w=i+1; } paixu(a,n); for(i=0;i<n;i++) {int count=0;float r=0; while(1) {zezhang(r); count++; if(a[i].z<r){cout<<"Property "<<a[i].w<<": This property will begin eroding in year "<<count<<'.'<<endl;break;} } } cout<<"END OF OUTPUT."<<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