本文整理汇总了C++中Quantity::print方法的典型用法代码示例。如果您正苦于以下问题:C++ Quantity::print方法的具体用法?C++ Quantity::print怎么用?C++ Quantity::print使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Quantity
的用法示例。
在下文中一共展示了Quantity::print方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main() {
Quantity a = 2 * units::m;
Quantity b = pow(a,10.0);
Quantity c = pow(b,0.5);
c = 1;
c *= constant::sigma_SB<si>::value();
c /= constant::sigma_SB<si>::value();
Quantity d = 10*unit::radian;
b.print(std::cout << "b: ", Quantity::UGLY_PRINT) << '\n';
c.print(std::cout << "c: ", Quantity::UGLY_PRINT) << '\n';
pow(b,0.1).print(std::cout << "pow(b,0.1): ", Quantity::UGLY_PRINT) << '\n';
std::cout << "b = " << b << "\n\n";
d.print(std::cout << "d: ") << '\n';
if (d.units.find("radian") == d.units.end())
std::cout << "d: could not find radian\n";
std::cout << "sigma_SB\t: " << constant::sigma_SB<si>::value() << '\n';
std::cout << "h_bar\t\t: " << constant::h_bar<si>::value() << "\n\n";
Quantity v = unit::m / unit::s;
Quantity A = v + constant::c<si>::value();
std::cout << v << v.units << constant::c<si>::value().units << std::endl;
/* For quantity<T>::operator+(T), and T = std::complex<>,
* this line does not work unless the 1.0 is wrapped inside something that
* will convert it to std::complex.
*/
Quantity v0 = v / constant::c<si>::value() + Quantity(1.0);
std::cout << "c\t\t: " << constant::c<si>::value() << "\n"
"v\t\t: " << v << "\n"
"A = v + c\t: " << A << "\n"
"v0 = v / c\t: " << v0
<< std::endl;
return 0;
}