我尝试了很多方法:
float a = 1234.34;
float b = 1234.52;
float r = a * b;
cout << r << endl;
float c = 1234.34 * 1234.52;
cout << c << endl;
cout << 1234.34 * 1234.52 << endl;
cout << (float)(1234.34 * 1234.52) << endl;
Run Code Online (Sandbox Code Playgroud)
所有这些似乎都给出了无限的价值......
1.52382e+006
1.52382e+006
1.52382e+006
1.52382e+006
Run Code Online (Sandbox Code Playgroud)
我在这做错了什么?
_3DTocka operator<<(ostream& os, _3DTocka _3D){
cout << "(" << _3D.x << "," << _3D.y << "," << _3D.z << ")" << endl;
}
Run Code Online (Sandbox Code Playgroud)
The above is my code and it gives an error: it must take exactly one argument (1 line)
_3DTocka is the name of the class..