我用的是 dev c++ 编译通过的
用不同编译器 编译器 是不同的
你用的是什么编译器??
根据你的错误信息 改了一下 试试吧
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <iomanip>
using namespace std;
class Point
{
public:
Point( double=0, double=0, double=0 );
void setPoint( double, double, double );
double getX() const { return x; }
double getY() const { return y; }
double getZ() const { return z; }
private:
double x,y,z;
};
Point::Point( double a, double b, double c ) { setPoint( a, b, c ); }
void Point:

etPoint( double a, double b, double c )
{
x=a;
y=b;
z=c;
}
int main()
{
int SIZE=10;
Point p[10];
srand( time(NULL) );
for ( int i=0; i<SIZE; i++ ) {
p[i].setPoint( (rand()%100 ) / float(100), rand()%100/float(100), 0.03 );
}
for ( int j=0; j<SIZE; j++ ) {
cout << setiosflags( ios::fixed | ios:

howpoint )
<< setprecision(2)
<< '[' << p[j].getX() << "," << p[j].getY() << "," << p[j].getZ() << "]";
cout << endl;
}
system( "pause" );
return 0;
}