原始字符串的表示

所谓原始字符串就是字符表示的就是自己,引号和斜杠均无需\进行转义。C++使用R“(a string)”来标识原始字符串:

cout << R"(I don't have to use '\' to print "\n" in the screen.)" << endl;

上述代码将显示如下内容:

I don't have to use '\' to print "\n" in the screen.

猜你喜欢

转载自www.cnblogs.com/sunyazhou/p/11322026.html
今日推荐