12. Numerics
12.1 complex numbers (p529)
#include <complex>
t12-2.png
t12-3.png
t12-4.png
t12-5.png
t12-7.png
12.7 valarrays(p547)
class valarray用于数值数组的运算,即数值线性序列。
#include <valarray>
13. stream class(p583)
stream定义了一些型别为iostate的常数,用于反映stream的状态。(p597)
t13-3.png
t13-4.png

t13-8.png
t13-9.png
t13-10.png
t13-11.png
t13-12.png
bool b;
// ...
std::cout << std::noboolalpha << b << " == " << std::boolalpha << b << std::endl;
t13-14.png
t13-16.png
setw()和setfilee()需提供参数,故需先包含头文件<iomanip>
eg:
#include <iostream>
#include <iomanip>
//...
std::cout << std::setw(8) << stdfill(‘_‘) << -3.14 << ' ' << 42 << std::endl;
std::cout << std::setw(8) << "sum: " << std::setw(8) << 42 << std::endl;
output:
___-3.14 42
___sum: ______42