首页 > 解决方案 > 我如何使用 cout<<"hello world"; 不使用;在行尾

问题描述

我想在不使用分号的情况下在 C++ 中显示 hello world 消息。我怎样才能做到这一点?可能吗?if else block like 我已经在里面试过了

if(true) {
cout<<"hello world"

}

但它不是那样工作的。

标签: c++cout

解决方案


if (cout << "hello world") {}

推荐阅读