Utxcpp Fast Guide
Utxcpp Fast Tutorial
CPP Tutorial
C++ Tutorial
You just use one header to include utxcpp library:
#include <utxcpp/core.hpp>
utx::print and utx::printnl are convenient way to print something out, which do not need you to worry about data types.
utx::print will add a newline at the end, but utx::printnl does not.
#include <utxcpp/core.hpp> int main() { utx::print(2, '+', 3, "is", 2+3); utx::printnl(2, '+', 3, "is", 2+3); utx::print(2, '+', 3, "is", 2+3); utx::printnl(2, '+', 3, "is", 2+3); }
The result will be:
2 + 3 is 5 2 + 3 is 5 2 + 3 is 5 2 + 3 is 5
#include <string> #include <utxcpp/core.hpp> int main() { utx::print("Hello, No.", 3, "World!"); std::string name; utx::printnl("Please Input Your Name:"); std::getline(std::cin, name); utx::print("\nYour name is", name); }
Possible Result:
Hello, No. 3 World! Please Input Your Name: Boost Software Your name is Boost Software
Hello, No. 3 World! Please Input Your Name: ^C
Hello, No. 3 World! Please Input Your Name: ^D Your name is
utx::fprint is implemented for better support iomanip format.
#include <utxcpp/core.hpp> #include <iomanip> // This is also "using namespace std::numbers" using namespace utx::numbers; // pi, e, egamma, phi int main() { utx::fmax bn = pi*e*egamma*phi; bn = bn * bn * bn * bn; utx::fprint(std::fixed, bn, ' ', std::scientific, bn, '\n'); }
Result:
4046.508104 4.046508e+03
If you only want to simply print something, not care about their format, just use utx::print.
utx::print just do the simple nice format for you;
Otherwise use utx::fprint.
Utxcpp provides the basic data types for convenient smoothly programming.
utx::i32 a = 9; utx::i32 b = -42; utx::u8 c = 255; utx::u64 d = 337; utx::print(a, b, (utx::u16)c, d); utx::print(utx::i8_max, utx::i8_min, utx::u64_max, utx::i32_max, utx::i32_min);
utx::ext::u24 a = 97; // 24 bit unsigned integral type. utx::print(a); utx::ext::u24 b = 0xA475FF; utx::print(b); utx::ext::i56 c = -100; // 56 bit signed integral type. utx::print(c);
using my_i59 = utx::ext::ext_integral_type<utx::i64, 59>; // 59 bits using my_u57 = utx::ext::ext_integral_type<utx::u64, 57>; // 57 bits my_i59 a = 332; my_u57 b = 233; utx::print(a, b); // 332 233 // 59 59 57 57 utx::print(a.bits(), my_i59::bits(), b.bits(), my_u57::bits());
Last revised: June 13, 2022 at 03:08:21 GMT |