何时包含引号
When to include quotation marks for cout
本文关键字:何时包 更新时间:2023-10-16
在
下面的示例中,cout 语句中的引号有什么作用?
cout << somevariable << " ";
我什么时候需要包括它们?
" "
表示空间。例如,当您要打印 2 个用空格分隔的字符串变量时:
std::string str1 = "Hello";
std::string str2 = "World";
std::cout << str1 <<" "<< str2;
输出:
Hello World
如果您在cout中询问"
,则用于在双引号内打印任何文本。
std::cout << "Any Text";
记住里面的空间" "
也是一个文本。
相关文章:
- 如何反转整数参数包
- 何时在引用或唯一指针上使用移动语义
- cmake如何在fedora工作站中找到boost静态库包
- 如何将enable-if与模板参数和参数包一起使用
- 何时提供默认参数作为模板参数
- C++-明确何时以及如何调用析构函数
- 在没有Xcode的情况下在Mac捆绑包中嵌入框架
- 为什么这个音频包络不能通过开关的情况?
- 模板元编程:如何将参数包组合成新的参数包
- 如何将C++闭包与变量参数同时重用——类似于JavaScript
- 在以唯一ptr为值的C++映射中,动态内存何时会被销毁
- AcquireCredentialsHandleA() 返回 PFX 文件的0x8009030e(安全包中没有可用的凭据
- 何时应通过引用传递矢量参数而不是按值传递矢量参数?
- C ++:在构造函数中使用参数包?
- struct.error:解压缩 C++ 结构时,解包需要 288 字节的缓冲区
- MSYS2 MinGW程序包中缺少grpc_cpp_plugin协议
- 如何使我的 sizeof sum 结构与空参数包一起工作
- boost::asio UDP 广播客户端仅接收"fast"数据包
- 模板参数包何时推断为空?
- 如何在使用WSARecv()和IOCP时知道套接字何时接收到FIN数据包