这段代码输出什么笑脸
What does this code output a smiley face?
#include <iostream>
#include <string>
using namespace std;
int main(){
string x;
x = not false and true;
cout << x << endl;
}
为什么这段代码在运行时会输出一个笑脸?
代码没有错。
not false and true
等同于1
!false && true
。
然后,使用 std::string::operator=(char)
将值分配给 x
。char
的 1
值显然意味着系统上的笑脸。
相关文章:
- 没有输出的合并排序我做错了什么?
- 什么是现实中的"endl"(或任何输出操纵器)?它是如何实现的,它如何与操作员<<一起工
- 为对象分配整数.输出将是什么?
- 以下与指针相关的代码的输出是什么?
- Omnet++中的.vec和.sca输出有什么区别?
- 流中的输入位置和输出位置有什么区别?
- 数组为此合并排序函数提供了正确的输出,但向量给出了不正确的输出.出了什么问题?
- 从 c++ 中的实例化进程获取输出的可靠方法是什么?
- 我的输出结果是 0 英寸C++.可能是什么问题
- 使输出流式处理运算符适用于 boost::variant<std::vector<int>、int、double 的正确方法是什么>
- 使用OpenMP获得完整、无损坏的输出需要什么
- 代码输出随机符号,我不确定出了什么问题
- 以下程序在 c++ 中的输出是什么?
- 堆排序,我无法弄清楚我的代码出了什么问题,输出顺序不正确
- 任何人都解释下面的代码,它的输出是什么?
- 当我打印字符串时,我不知道它是什么输出
- 为什么输出不同以及此代码中有什么错误
- 为C程序获取不同的输出?该程序应该输出什么
- 这段代码输出什么笑脸
- 在c++中,如果超出范围,将输出什么值