ch3.11.cc

来自「C++ source code for book-C++ and Object 」· CC 代码 · 共 23 行

CC
23
字号
#include <cerrno>
#include <cfloat>
#include <iostream>
#include <climits>
#include <cmath>

main() {

using namespace std;

errno = 0;                           // clear old error state. Include <errno.h>
double x = - 50;                     // or x is computed at run time 
double i = sqrt(x);
if (errno == EDOM) cerr << "sqrt() not defined for negative numbers\n";
double p = pow(DBL_MAX, 2);
if (errno == ERANGE) cerr << "result of pow(double,int) overflows\n";

errno = 0;                           // clear old error state. Include <errno.h>
int jj = INT_MAX + 5;
if (errno == ERANGE) cerr << "result of jj overflows\n";

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?