2009年11月4日星期三

C++ way to convert from a double to an int

The C++ way to convert from a double to an int is with static_cast:

int m;
double x;

m = static_cast<int>(x);

没有评论:

发表评论