主题: help me~~
查看单个帖子
  #7 (permalink)  
旧 2005-07-25
bryant.yan bryant.yan 当前离线
初级会员
 
注册日期: 2005-07-25
帖子: 5
bryant.yan 正向着好的方向发展
默认

我用的是 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;
}
回复时引用此帖