c++ - 我的表情符号程序在C++中显示带有问号的框

标签 c++ windows dev-c++

Error screenshot.
我正在测试一个程序来打印C++中的表情符号。我的编码环境是Dev C++。但是执行时,它会显示一个问号,而不是所需的表情符号。
任何有用的建议来解决我的问题,将不胜感激。
这是我的代码:

#include <iostream>
#include <conio.h>
#include <stdlib.h>

using namespace std;

int main(void)
{
    system("cls");

    int sml = 1, i, limit;
    char ch = sml;

    cout << "How many smiley face you want to print ? ";
    cin >> limit;

    for (i = 0; i < limit; i++)
    {
        cout << ch << ' ';
    }
    return 0;
}

最佳答案

您编写的程序是正确的。是控制台出现故障。无法为您传递的ASCII值打印相应的字符。我建议您更改控制台(有关操作方法的提示,您必须在Google上进行搜索)。
看一下我的控制台输出:
enter image description here

关于c++ - 我的表情符号程序在C++中显示带有问号的框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62726760/

相关文章:

c++ - 获取 IAMStreamConfig 接口(interface)失败

c++ - 组合返回 future 的功能

windows - 在文件 URI 方案中使用 Windows 环境变量

c++ - 读取bmp文件中的像素值

c - 为什么这个 for 循环在第二个索引处结束?

c++ - 我的私有(private)方法如何访问 C++ 中的公共(public)枚举?

c++ - 应该用 typedef 触发 static_assert 吗?

windows - Windows 上的 Perl GUI 编程

python - 卸载通过 cx_freeze bdist_msi 创建的先前安装的 msi

c++ - 无法识别的命令行选项 -std=c++11 或 -std=c++0x