标签:The 绝对值 ... lex double var 字符串 htm ras
分割字符串:https://www.cnblogs.com/zealousness/p/9971709.html
字符串比较:https://www.cnblogs.com/zealousness/p/10140189.html
求绝对值:
#include<cmath> std::cout<<abs(-2)<<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[32]; 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);
标签:The 绝对值 ... lex double var 字符串 htm ras
原文地址:https://www.cnblogs.com/zealousness/p/10151740.html