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