c++ - 我如何使用 cout<<"hello world"; 不使用;在行尾
问题描述
我想在不使用分号的情况下在 C++ 中显示 hello world 消息。我怎样才能做到这一点?可能吗?if else block like 我已经在里面试过了
if(true) {
cout<<"hello world"
}
但它不是那样工作的。
解决方案
if (cout << "hello world") {}
推荐阅读
- ios - 如何检查我的应用程序是否启用了 Face id?
- apache - 在文件中记录存储在 .htpasswd 中的 htaccess apache 访问用户
- aframe - 按下按钮期间:将相机移动到视线方向
- laravel - Laravel Doctrine, (doctrine:schema:update) 不会为新添加的实体创建表
- javascript - React 中的和解
- javascript - QUnit 测试套件完成时登录到终端?
- php - 如何将数据和字符串上传到 sderver [Swift,Php]
- javascript - 如何使包装在函数中的函数代表父函数返回
- python - 使用 Pycharm 编写 gem5 配置脚本
- android - firebaseRecyclerAdapter 被填满,但不会在对话框中显示任何内容 - Android Studio