用"printf"输出string类字符

在遇到大量输入输出的时候,我们知道printf & scanf的效率要大于cin & cout。

但在用到STL的时候,又难免用到string,于是有以下方法。

View Code
1 string test("nothing");
2 printf("%s", test.c_str());

  

原文地址:https://www.cnblogs.com/alex4814/p/2136570.html