7
使用std :: string的printf?
我的理解是,它string是std名称空间的成员,那么为什么会发生以下情况? #include <iostream> int main() { using namespace std; string myString = "Press ENTER to quit program!"; cout << "Come up and C++ me some time." << endl; printf("Follow this command: %s", myString); cin.get(); return 0; } 每次程序运行时,都会myString打印一个看似随机的3个字符的字符串,例如在上面的输出中。
157
c++
string
namespaces
printf
std