C++C++14C++17C++20Learn C++

Learn To Use Digit Separators In Modern C++

Learn To Use Digit Separators In Modern C++

In the history of modern C++, the C++14 standard brings us some very useful features. C++14 comes with the digit seperators feature. In C++14 and above, we can use the digit separator  to separate integer numbers. In this post, we explain, how to use digit separators in examples,

How can I use use digit separators in modern C++?

In C++14, there is a new Digit Separators feature. The digit separator is a single-quote character  that can be used within a numeric literal for aesthetic readability. When you use digit separators, it does not affect the numeric value, but it is very useful when you are using bigger or longer digital numbers. It can be used with int, long int, long long int, float, double, auto, etc. 

Here is a simple example to digit separators.

Is there a full example about to use digit separators in modern C++

Here is a full example about to use digit separators in modern C++.

and the output will be as follows:

Note that, C++ Builder IDE also supports digit seperators.

For more details, please see this digit separators https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3499.html

Learn To Use Digit Separators In Modern C++ C++ Builder logo

C++ Builder is the easiest and fastest C and C++ IDE for building simple or professional applications on the Windows, MacOS, iOS & Android operating systems. It is also easy for beginners to learn with its wide range of samples, tutorials, help files, and LSP support for code. RAD Studio’s C++ Builder version comes with the award-winning VCL framework for high-performance native Windows apps and the powerful FireMonkey (FMX) framework for cross-platform UIs.

There is a free C++ Builder Community Edition for students, beginners, and startups; it can be downloaded from here. For professional developers, there are Professional, Architect, or Enterprise version.

Oh hi there 👋
It’s nice to meet you.

Sign up to receive awesome C++ content in your inbox, every day.

We don’t spam! Read our privacy policy for more info.

About author

Dr. Yilmaz Yoru has 35+ years of coding with more than 30+ programming languages, mostly C++ on Windows, Android, Mac-OS, iOS, Linux, and some other operating systems. He graduated and received his MSc and PhD degrees from the Department of Mechanical Engineering of Eskisehir Osmangazi University. He is the founder and CEO of ESENJA LLC Company. His interests are Programming, Thermodynamics, Fluid Mechanics, Artificial Intelligence, 2D & 3D Designs, and high-end innovations.
Related posts
C++C++11C++14C++17C++20Learn C++Syntax

What is the negation (std::negation) metafunction in C++?

C++C++11C++14C++17C++20Learn C++Syntax

What Is Multiset (std::multiset) In Modern C++?

C++C++11C++14C++17C++20Learn C++Syntax

What Is Set (std::set) In Modern C++?

C++C++11C++14C++17C++20IteratorsLearn C++

What Is Deque (std::deque) In Modern C++?