|  | 
|  | 
| back to board | Discussion of Problem 1020. RopeWhy my program got CE? // Timus 1020#include "iostream.h"
 #include "math.h"
 
 void main()
 {
 int i,n;
 double r,L,x[100],y[100];
 cin>>n>>r;
 for (i=1;i<=n;i++)
 { cin>>x[i]>>y[i];}
 x[0]=x[n]; y[0]=y[n];
 L=0;
 for (i=0;i<n;i++)
 { L+=(sqrt(pow(x[i]-x[i+1],2)+pow(y[i]-y[i+1],2)));
 }
 L+=2*r*M_PI;
 cout.precision(2);
 cout<<L;
 }
#include<iostream.h>, i mean < >(-) > // Timus 1020> #include "iostream.h"
 > #include "math.h"
 >
 > void main()
 > {
 >   int i,n;
 >   double r,L,x[100],y[100];
 >   cin>>n>>r;
 >   for (i=1;i<=n;i++)
 >   { cin>>x[i]>>y[i];}
 >   x[0]=x[n]; y[0]=y[n];
 >   L=0;
 >   for (i=0;i<n;i++)
 >   { L+=(sqrt(pow(x[i]-x[i+1],2)+pow(y[i]-y[i+1],2)));
 >   }
 >   L+=2*r*M_PI;
 >   cout.precision(2);
 >   cout<<L;
 > }
 >
Re: #include<iostream.h>, i mean < >(-) Posted by Nothing  10 Jun 2002 19:11Thanks.But there isn't this problem.
 | 
 | 
|