如何用逗号写数字?

How to write Numbers With Commas?

有时在 C++ 中我想使用像 1000000 这样的大数字,这很混乱。如何使用逗号(如果可能的话)?

例如,我希望它能工作

int x = 1,000,000;

您使用 digit separator 自 c++14

int x = 1'000'000 

这对你有用吗?