分割字符串:https://www.cnblogs.com/zealousness/p/9971709.html
字符串比较:https://www.cnblogs.com/zealousness/p/10140189.html
求绝对值:
#include<cmath>
std::cout<<abs(-)<<std::endl;
开平方:
#include<cmath>
std::cout<<sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))<<std::endl;
异常处理:
try{
...
}catch(std::exception e){
...
}
double 转字符串
// The C way:
char buffer[];
snprintf(buffer, sizeof(buffer), "%g", myDoubleVar); // The C++03 way:
std::ostringstream sstream;
sstream << myDoubleVar;
std::string varAsString = sstream.str(); // The C++11 way:
std::string varAsString = std::to_string(myDoubleVar); // The boost way:
std::string varAsString = boost::lexical_cast<std::string>(myDoubleVar);