printf with std :: string?我的理解是它string是std命名空間的成員,為什么會(huì)出現(xiàn)以下情況呢?#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;}每次程序運(yùn)行時(shí),都會(huì)myString打印一個(gè)看似隨機(jī)的3個(gè)字符的字符串,例如上面的輸出。
printf with std :: string?
明月笑刀無(wú)情
2019-08-27 10:12:42