<分区>
在 Java 中我可以做到:
int i = 1_200_200;
如何在 C++ 中做同样的事情?我的意思是我应该使用什么来代替下划线?
<分区>
在 Java 中我可以做到:
int i = 1_200_200;
如何在 C++ 中做同样的事情?我的意思是我应该使用什么来代替下划线?
最佳答案
自 C++14 起,您可以对 integer literal 使用单引号 (')提高可读性,例如
int i = 1'200'200;
Optional single quotes(') may be inserted between the digits as a separator. They are ignored by the compiler.
关于c++ - C++文字中的分隔符十和单位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46254084/