cloudywizzard – Cloudywizzard

cloudywizzard

printf format specifiers

Printf format specifiers in C digits : printf(“%d”, 42);doubles: printf(“%.2lf”, 3.14);floats: printf(“%.4f”, 3.1415);characters: printf(“%c”, ‘C’);strings: printf(“%s”, title);sizeof: printf(“%zu”, sizeof(char));pointers: printf(“%p”, a);

The Spaceship Operator: <=>

C++20 introduces the “Three-Way Comparison Operator” also known as the spaceship operator. A simple example the std::strong_ordering is only available for integral types, for floating-point values there is the std::partial_ordering (less, greater, equivalent and unordered). For your own defined types there is also the std::weak_ordering (less, greater, equivalent)

Hello, World!

Lets write the classic first program using the new C++20 language features using the std::format Since the format module is not available yet, you can opt for the {fmt} library from https://fmt.dev) which is the library the format module is build on. I’m using the using directive to make it as easy as possible to …

Hello, World! Read More »