为了账号安全,请及时绑定邮箱和手机立即绑定

printf with std :: string?

printf with std :: string?

C++
明月笑刀无情 2019-08-27 10:12:42
printf with std :: string?我的理解是它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个字符的字符串,例如上面的输出。
查看完整描述

3 回答

  • 3 回答
  • 0 关注
  • 427 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号