使用 toupper() 函数时,它输出 ASCII 值为什么会这样,我如何让它只打印字符?

问题描述

当使用 toupper() 函数时,它输出 ASCII 值。为什么会这样,我如何让它只打印字符? 这是我的代码

    #include <iostream>
    #include <cctype>
    
    using namespace std;
    
    int main()
    {   char ch1 = 'H';
        char ch2 = 'e';
        char ch3 = '!';
        cout << toupper(ch1); // displays 'H'
        cout << toupper(ch2); // displays 'E'
        cout << toupper(ch3); // displays '!'
        return 0;
    }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)